How to update other components on transfering contents of primefaces picklist?
I am using PrimeFaces-3.0.RC1-SNAPSHOT pickList. I want to invoke some function on transfering any item from source to target and vice versa so as to update the contents of another picklist.
I tried by adding
valueChangeListener="#{myBean.refreshList}"
In refreshList() I add the contents to a list which is set as value for the other pickList whose contents are to be updated and the autoupdate attribute of p:outputPanel 开发者_StackOverflow中文版which contains the second pickList is set as true.
But I have to invoke the function by some other means (using a commandButton etc) to update the second pickList. How can I update the second pickList without doing so?
transfering any item from source to target and vice versa
does not submit the form to server.
valueChangeListener="#{myBean.refreshList}"
executes only when the form is submitted to the server and the value of component (in your case the 'picklist') has actually changed.
So, what you need to do is - submit it every time the transferring takes place.
You can use the onTransfer
attribute of the PickList.
精彩评论