PrimeFaces 6.1.RC1 DataTable row groups - sorting breaks grouping

UI Components for JSF
Post Reply
User avatar
tefron
Posts: 94
Joined: 15 Sep 2010, 23:54
Location: Canada
Contact:

13 Mar 2017, 20:15

PrimeFaces 6.1.RC1

DataTable expandableRowGroups - sorting breaks grouping
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final

User avatar
tefron
Posts: 94
Joined: 15 Sep 2010, 23:54
Location: Canada
Contact:

20 Mar 2017, 19:01

It would be nice if there was an option to instead of tying the groups to the current table sort, there would be a property on the table to group by and the groups would stay together regardless of sorting. Similar to the sub-table functionality (only that one doesn't expand/collapse)
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

30 Mar 2017, 23:47

Please file an issue (with a good example)

hbai
Posts: 1
Joined: 01 Feb 2017, 02:33

19 Jul 2017, 23:40

Did this problem get reported or resolved? I have the same problem: (nested dataTables) (Useing PF 6.1 community version)

<p:dataTable var="pDataTable" value="#{aBean.getAddrByIdList()}"
sortBy="#{pDataTable.getSource().getLast_name()}, #{pDataTable.getSource().getFirst_name()}">

<p:column style="width:16px">
<p:rowToggler />
</p:column>
<p:column style="font-size: 80%;">
<h:outputText id="hdrNameId"
value="#{pDataTable.getSource().getLast_name()}, #{pDataTable.getSource().getFirst_name()} (#{pDataTable.getSource().getId()})" />

</p:column>

<p:rowExpansion>
<p:dataTable var="addr" id="addr"
value="#{pDataTable.getSource().getAddrList()}" sortMode="multiple"
selection="#{aBean.selectedAddr}" selectionMode="single"
rowKey="#{addr.addressId}">
<p:column id="Id" colspan="8" headerText="Id"
sortBy="#{pDataTable.getSource().getId()}">
<h:outputText value="#{pDataTable.getId()}" />
</p:column>
<p:column id="address" colspan="8" headerText="Address"
sortBy="#{addr.streetAddress}">
<h:outputText value="#{addr.streetAddress}" />
</p:column>
<p:column colspan="3" headerText="Type" sortBy="#{addr.addressId}">
<h:outputText value="#{addr.addressId}" />
</p:column>
<p:column colspan="3" headerText="Type" sortBy="#{addr.addressType}">
<h:outputText value="#{addr.addressType}" />
</p:column>
<p:column colspan="2" headerText="Actv" sortBy="#{addr.activeFlag}">
<h:outputText value="#{addr.activeFlag}" />
</p:column>

<p:ajax event="rowDblselect" listener="#{aBean.onRowSelectAddr}"
update="@this" />
</p:dataTable>
</p:rowExpansion>
</p:dataTable>


This is the original data,
Lastname2, FirstName2, [{id1,streetAddress1,addressId1,addressType1,activeFlag1},{id2,streetAddress2,addressId2,addressType2,activeFlag2}]
Lastname3, FirstName3, [{id3,streetAddress3,addressId3,addressType3,activeFlag3},{id4,streetAddress4,addressId4,addressType4,activeFlag4},{id5,streetAddress5,addressId5,addressType5,activeFlag5}]
Lastname1, FirstName1, [{id6,streetAddress6,addressId6,addressType6,activeFlag6},{id7,streetAddress7,addressId7,addressType7,activeFlag7},{id8,streetAddress8,addressId8,addressType8,activeFlag8},{id9,streetAddress9,addressId9,addressType9,activeFlag9}]
Since sorting on lastname, firstname and id on the outtter datatbale and soring on inner datatble is not working, but that is not the concern here.

The problem is the resulting nested table is totalling incorrect.

Here is the result:
Lastname1, FirstName1
id1,streetAddress1,addressId1,addressType1,activeFlag1
id2,streetAddress2,addressId2,addressType2,activeFlag2
Lastname2, FirstName2
id3,streetAddress3,addressId3,addressType3,activeFlag3
id4,streetAddress4,addressId4,addressType4,activeFlag4
id5,streetAddress5,addressId5,addressType5,activeFlag5
Lastname3, FirstName3,
id6,streetAddress6,addressId6,addressType6,activeFlag6
id7,streetAddress7,addressId7,addressType7,activeFlag7
id8,streetAddress8,addressId8,addressType8,activeFlag8
id9,streetAddress9,addressId9,addressType9,activeFlag9

The correct result should be:
Lastname1, FirstName1
id6,streetAddress6,addressId6,addressType6,activeFlag6
id7,streetAddress7,addressId7,addressType7,activeFlag7
id8,streetAddress8,addressId8,addressType8,activeFlag8
id9,streetAddress9,addressId9,addressType9,activeFlag9
Lastname2, FirstName2
id1,streetAddress1,addressId1,addressType1,activeFlag1
id2,streetAddress2,addressId2,addressType2,activeFlag2
Lastname3, FirstName3,
id3,streetAddress3,addressId3,addressType3,activeFlag3
id4,streetAddress4,addressId4,addressType4,activeFlag4
id5,streetAddress5,addressId5,addressType5,activeFlag5

The issue is, the outer datatable is sorted, but the inner datable data does not. It stay the same and match to the wrong outter data.

Also, as I mentioned, inner datatable is sorting does not work.

User avatar
tefron
Posts: 94
Joined: 15 Sep 2010, 23:54
Location: Canada
Contact:

20 Jul 2017, 21:42

The problem wasn't resolved as far as I know, however, you are doing something completely different while probably looking for the same end result as me.
You nested tables in an expansion, while I tried to use the new row group functionality. Which works great until sorting breaks the groups. The row group is based on the sorts and doesn't let you group by one property while sorting by another.
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final

mafaul
Posts: 13
Joined: 12 Jan 2015, 07:24

25 Sep 2017, 11:24

What is the issue's URL / title on GitHub? I would like to vote for it.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

25 Sep 2017, 21:37

I don't think one was filed. If you still have the same problem, please file an issue.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests