如何通过javascript获取和更新Primefaces pickList bean源和目标列表

时间:2013-04-19 08:29:34

标签: javascript primefaces interaction

我正在开发一个具有选择交互的地图应用程序。在选择城市时尝试更新pickList bean。

<script>  
function onCitySelected(e) {  

   // get myPrimeFacesPickList

   // update myPrimeFacesPickList : move e.selectedCity source to target 
}  
</script>

有没有办法在我的javascript代码中获取和更新源列表和目标城市列表?

1 个答案:

答案 0 :(得分:0)

也许使用素数RemoteCommand

它将为您的页面添加一个js函数,您可以在onCitySelected函数中使用该函数。然后调用该函数将在您的辅助bean中触发一个方法,您可以在其中将所选城市添加到模型中(使用<f:setPropertyActionListener>),然后通过在update中设置列表的ID来更新您的pickList remoteCommand的属性。

查看primefaces展示中的show case for remoteCommand,并查阅remoteCommand组件上的primefaces documentation

相关问题