Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用javascript API从Richfaces PickList sourceList中选择项目?_Javascript_Richfaces - Fatal编程技术网

如何使用javascript API从Richfaces PickList sourceList中选择项目?

如何使用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(

我正在使用Richfaces 4.5.1拾取列表组件,我需要使用javascript从源列表中选择一项。我正在查看Richfaces文档中的javascript API,并且能够毫无问题地使用getSourceList()和add()函数。文档中说getSourceList()将为您提供javascript列表对象,您可以在其中选择/取消选择项。问题是它没有告诉您选择/取消选择项的函数名。如果不先选择一个项目,我就不能使用add()

Javascript函数:

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属性中设置适当的数据。