DataTable + dynamic columns + row editor + validation error + sort = rows data swap

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

26 Oct 2018, 22:38

DataTable + dynamic columns + row editor + validation error + sort = rows data swap:

1. edit row and enter an invalid value.
2. sort the table so the edited row change location
The edited row is getting values from the row that was previously in that location.

It happens only with dynamic columns.
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 Oct 2018, 11:41


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

30 Oct 2018, 17:17

I reproduced it with the prime faces test.
The code is the same as the prime faces demo for dynamic columns, only I added a row editor.
Steps to reproduce:
1. edit row
2. enter invalid value for year (e.g. qqq)
3. accept edit - red mark appears next to the invalid value
4. press the year header to sort.

The rows values are swapped.



Here is the code (I can send you back the project if you give me instructions) :
columns.xhtml

Code: Select all

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <h:form id="form"> 
            <p:growl id="msgs" showDetail="true"/>
            <p:dataTable id="cars" var="car" value="#{dtColumnsView.cars}" widgetVar="carsTable" filteredValue="#{dtColumnsView.filteredCars}" editable="true">                    
                <p:column style="width:32px">
                    <p:rowEditor />
                </p:column>
                <p:columns value="#{dtColumnsView.columns}" var="column" columnIndexVar="colIndex" sortBy="#{car[column.property]}" filterBy="#{car[column.property]}">
                    <f:facet name="header">
                        <h:outputText value="#{column.header}" />
                    </f:facet>
                    <p:cellEditor>
                        <f:facet name="output"><h:outputText value="#{car[column.property]}" /></f:facet>
                        <f:facet name="input"><p:inputText value="#{car[column.property]}" style="width:100%" label="Year"/></f:facet>
                    </p:cellEditor>
                </p:columns>
            </p:dataTable>
        </h:form>    
    </h:body>
</html>

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 Oct 2018, 17:25

Please put it in a git repo somewhere somewhere.

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

30 Oct 2018, 22:41

Can you please refer me to detailed instructions how to do that?

Thanks.
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

31 Oct 2018, 09:33

How to put something in a git (or other repository)? Lots and lots of info on that if you use Google. Sorry, but that part is out of 'support-scope' for me here. But if you think it is a bug (or real issue) create an issue in the issuelist and attach the project in a zip file there.

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

31 Oct 2018, 17:03

I submitted the issue and attached the zip file as you suggested:

https://github.com/primefaces/primefaces/issues/4186

Thanks for you help.
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:

02 Nov 2018, 20:05

fixed the data swap by adding resetValues="true" to page, filter, sort and rowEditCancel events.

Losing data is not as bad as swapping...
PrimeFaces: primefaces-8.0
Mojara2.3
Netbeans8.2
wildfly-17.0.1.Final

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 25 guests