How to know which item is clicked in richfaces PickList

送分小仙女□ 提交于 2019-12-24 08:47:13

问题


I am using richfaces 4.1.0M2 with JSF2.0 and I have a PickList and what I want is that when someone selects (mouse click) an item in the left list, some component in the form is updated based on what is clicked. I have managed to trigger an event in the bean whan some one clicks on an item. The code to achieve the trigger is

<rich:pickList showButtonsLabel="false" value="#{groupBean.pickListResult}"
                                    listHeight="100"  converter="#{groupBean.converter}">
                                    <a4j:ajax event="click" render="userlist" limitRender="true" listener="#{groupBean.updateGroupMembers}"/> 
                                    <f:selectItems value="#{groupBean.leftPickList}" />
                       </rich:pickList>

But I am not able to get the value of SelectItem which was clicked. Any idea how I can do that. I read in the documentation that each item has three states associated with it in the PickList i.e common, selected, active. So is there a way to get these states in the bean. Any idea.


回答1:


The selected value will be available in groupBean.pickListResult (on the server)




回答2:


I Think you Should use onchange Event in <a:support>

ex: <a4j:ajax event="onchange" render="userlist" limitRender="true" />


来源:https://stackoverflow.com/questions/7678838/how-to-know-which-item-is-clicked-in-richfaces-picklist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!