primefaces icon indicating copy to clipboard operation
primefaces copied to clipboard

DataTable: Filtering nested datatables not working

Open fanste opened this issue 1 year ago • 5 comments

Describe the bug

We have a data table that uses a row expansion which contains again a data table. This goes up to 3 nested data tables.

After upgrading from PF8 to PF11 this construct is not working anymore. The worst thing on that is, that it probably only worked because on how the property filteredValue was implemented up to PF8 (PF 10 is not yet tested). By checking what is going on, we also noticed, that it is only working partially with PF8 (the data tables in the row expansion do affect each other regarding filtering).

So the first question, before providing a reproducer and going into more detail: is nesting data tables supposed to be supported or not?

Reproducer

No response

Expected behavior

No response

PrimeFaces edition

Community

PrimeFaces version

11.0.0

Theme

No response

JSF implementation

Mojarra

JSF version

2.2.19

Java version

8

Browser(s)

No response

fanste avatar Apr 12 '23 10:04 fanste

Does it work in 13 Snapshot?

tandraschko avatar Apr 12 '23 10:04 tandraschko

Looks good on the first try. We will run some more tests

fanste avatar Apr 13 '23 08:04 fanste

After some more testing, it is NOT working - in my first test I used the first row of the table which was still the first row after filtering.

The first problem is still the same: A iteration-based filteredValue is not working.

  • DataTable 1 var="a" value="#{bean.list}" filterValue="#{bean.filteredList}"
  • DataTable 2 var="b" value="#{a.list}" filteredValue="#{a.filteredList}"
  • DataTable 3 var="c" value="#{b.list}" filteredValue="#{b.filteredList}"

DataTable 2 and 3 are in a rowExpansion of the former DataTable. I will now try to create a reproducer if wanted.

The second problem: Filter values of the DataTable 2 affect each other.

  • DataTable 1 has 3 rows. Each row contains an additional DataTable 2 in the row expansion.
  • Set a filter on DataTable 1; Row Expansion 1; DataTable 2
  • Set a filter on DataTable 1 which excludes the first row of DataTable 1
  • Open the row expansion of the new Row 1 in DataTable 1
  • => Previous Row Expansion 1; DataTable 2 filters are applied

fanste avatar Apr 14 '23 07:04 fanste

A reproducer would be great.

melloware avatar Apr 14 '23 11:04 melloware

Sorry for the delay - a lot to do..

Reproducer: https://github.com/fanste/primefaces-test/tree/test-10013

Some observations by myself.

Working as expected:

  • Filter by Table 1 Col 1
  • Filter by Table 2 Col 1 as long as filter parent level(s) is unchanged

Partial working:

  • Filter by Table 2 Col 1 when filter of parent level is changed, as it at least won't show wrong data. The filter seems somehow to be stored by parent row-index and is re-applied to the new row-index.
    • e.g. Filter Table 1 Col 1 by 02. The value in row 2 (index 1) is 020.
    • Expand that row and filter Table 2 Col 1 by 001. Only a single row is displayed 020.001
    • Remove filter in Table 1 Col 1. The new index 1 is 002 which has the filter set on 020.
    • Navigate to 020, it won't have any filter.

Not working at all:

  • Filter by Table 2 Col 1 as Table 3 is always empty.

fanste avatar May 09 '23 13:05 fanste