如何使用javascript API从Richfaces PickList sourceList中选择项目?
我正在使用Richfaces 4.5.1拾取列表组件,我需要使用javascript从源列表中选择一项。我正在查看Richfaces文档中的javascript API,并且能够毫无问题地使用getSourceList()和add()函数。文档中说getSourceList()将为您提供javascript列表对象,您可以在其中选择/取消选择项。问题是它没有告诉您选择/取消选择项的函数名。如果不先选择一个项目,我就不能使用add() Javascript函数:如何使用javascript API从Richfaces PickList sourceList中选择项目?,javascript,richfaces,Javascript,Richfaces,我正在使用Richfaces 4.5.1拾取列表组件,我需要使用javascript从源列表中选择一项。我正在查看Richfaces文档中的javascript API,并且能够毫无问题地使用getSourceList()和add()函数。文档中说getSourceList()将为您提供javascript列表对象,您可以在其中选择/取消选择项。问题是它没有告诉您选择/取消选择项的函数名。如果不先选择一个项目,我就不能使用add() Javascript函数: function refresh(
function refresh() {
var source = #{rich:component('customer')}.getTargetList();
INSERT CODE TO SELECT FROM source LIST
#{rich:component('customer')}.add();
}
<rich:pickList id="customer" value="#{payrollCreate.nameList}" listHeight="200" sourceCaption="Available Customers" targetCaption="Selected Customers" orderable="true">
<f:selectItems value="#{payrollCreate.clients}"/>
</rich:pickList>
Richfaces选择列表:
function refresh() {
var source = #{rich:component('customer')}.getTargetList();
INSERT CODE TO SELECT FROM source LIST
#{rich:component('customer')}.add();
}
<rich:pickList id="customer" value="#{payrollCreate.nameList}" listHeight="200" sourceCaption="Available Customers" targetCaption="Selected Customers" orderable="true">
<f:selectItems value="#{payrollCreate.clients}"/>
</rich:pickList>
有人能帮我吗?
谢谢…你不需要javascript,你可以用Java来做。我试过了。我已经试着在服务器端和客户端完成这项工作。例如,当我刷新页面以显示更改时,它会返回初始状态。在pickList(selectItems的子集)的value属性中设置适当的数据。