I believe I found a bug with p:dataTable while investigating a question on StackOverflow (http://stackoverflow.com/questions/8764 ... ean-even-a). The issue is that, when reloading a page, Firefox tries to save changed form values and restore them after reload so that the user does not lose what they entered. Since p:dataTable uses a hidden form element to keep track of the selection, Firefox restores this value. This leads to the rendered selection and the actual selection being different.
I think that the p:dataTable component should either explicitly clear out the hidden input or read the value and render the selection in the table to reflect the hidden input. I personally tested this on FF4 (Mac OS X) and the original reporter said that they'd seen it on FF8, though someone else followed up saying that they didn't see it on FF9.
Thanks.
p:dataTable selection model gets out of sync after reload in
Yes, this is a Firefox "feature". There are many links about this.
http://alexscordellis.blogspot.com/2010 ... -with.html
http://stackoverflow.com/questions/6487 ... -auto-fill
Just interesting why PrimeFaces doesn't have autocomplete="off" for hidden fields. I think other components are affected too. I could see this issue in 2.2.1. Please create an issue ticket.
http://alexscordellis.blogspot.com/2010 ... -with.html
http://stackoverflow.com/questions/6487 ... -auto-fill
Just interesting why PrimeFaces doesn't have autocomplete="off" for hidden fields. I think other components are affected too. I could see this issue in 2.2.1. Please create an issue ticket.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
-
- Posts: 280
- Joined: 25 Jun 2010, 01:18
Here is the issue report for this: http://code.google.com/p/primefaces/iss ... il?id=3263
Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7
-
- Posts: 280
- Joined: 25 Jun 2010, 01:18
Oddly, I can still replicate this under FF9. Can anyone try this code and see if they can replicate this? Thanks in advance. PF 3 Final + tomcat 7
Code: Select all
<p:growl id="messages" showDetail="true" />
<p:messages id="msgs"/>
<h:form id="form">
<p:dataTable value="#{viewBean.foodList}" var="item"
selection="#{viewBean.selectedFoods}"
selectionMode="multiple"
rowKey="#{item}">
<p:column>
#{item}
</p:column>
<f:facet name="footer">
<p:commandButton value="Submit" update=":form:display :dataList"
action="#{viewBean.checkSelection}"/>
</f:facet>
</p:dataTable>
<p:dataList id="display" value="#{viewBean.selectedFoods}" var="item"
itemType="disc">
#{item}
</p:dataList>
</h:form>
<p:dialog id="dialog1" widgetVar="dialog1" dynamic="true" width="200">
<p:dataList id="dataList" value="#{viewBean.selectedFoods}" var="item"
itemType="disc">
#{item}
</p:dataList>
</p:dialog>
Code: Select all
@ManagedBean
@ViewScoped
public class ViewBean implements Serializable {
private List<String> foodList;
private String[] selectedFoods;
@PostConstruct
public void init() {
foodList = new ArrayList<String>();
foodList.add("Pizza");
foodList.add("Pasta");
foodList.add("Hamburger");
}
public void checkSelection(){
RequestContext requestContext = RequestContext.getCurrentInstance();
if(selectedFoods.length > 0){
requestContext.execute("dialog1.show()");
}else{
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Error", "Please select"));
requestContext.addPartialUpdateTarget("messages");
}
}
//setter, getter
}
Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Try setting autocomplete off to the hidden field and let me know if it fixes the issue, if so we can add it to PrimeFaces. To do this, you need to know how to build PF from source for a local test.
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
I have added autocomplete off to trunk, you can try with the build from repo to see if it fixes your issue.
-
- Posts: 280
- Joined: 25 Jun 2010, 01:18
Thank you Optimus, I will do it as soon as I get home. Thanks a lot.
Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7
-
- Posts: 280
- Joined: 25 Jun 2010, 01:18
Hi Optimus, sorry that it took me two days to test this out, but I have compile the latest SNAPSHOT, and it seems like remove autocomplete fix this problem. Thank you. I also notice that p:selectOneMenu suffer from the same problem. You can test at http://www.primefaces.org/showcase-labs ... neMenu.jsf. Select one item in the drop down, and refresh. On chrome and IE, the drop down value reset back to "Select One", but on Firefox, it retain this value. Anyway, I will make this a separate post.
Mojarra 2.1.10, Glassfish 3.1, Tomcat 7, Primeface 3.3.1
IE 6-8, FireFox 10-13
MAC OSX Lion, Windows XP, 7
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
There is no hidden input in select one menu.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 18 guests