【问题标题】:Primefaces Tree set checkboxesPrimefaces 树集复选框
【发布时间】:2010-05-25 05:02:01
【问题描述】:

我有一个使用 Primefaces 的 JSF 应用程序。我使用多选树组件,它在每个树节点上都包含一个复选框。我的问题是我需要使用来自支持 bean 的值预先选择树节点。似乎 jquery 将是要走的路,但我不知道如何从 jquery 中的 managedbean 中检索对象值以及如何选择树节点。

<p:tree cache="true" id="InstrumentTree"
    selection="#{managedbeans$AssignmentsManagedBean.selectedNodes}"
    value="#{managedbeans$AssignmentsManagedBean.root}" var="node" widgetVar="InstrumentTree1">
    <p:treeNode>
    event="select"/>                                                             
    <h:outputText value="#{node.name}"/>                                                                  
    <h:selectBooleanCheckbox  id="treeCheck" />        
    </p:treeNode>
</p:tree>

关于如何从支持 bean 中预先选择树上的值的任何建议。

【问题讨论】:

    标签: java jquery jsf primefaces


    【解决方案1】:

    类似;

    for (Iterator<TreeNode> it = root.getChildren().iterator(); it.hasNext();) {
            String name = it.next().toString();
            if (list.contains(name)) {
                it.next().setSelected(true);
            } 
    
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-29
      • 1970-01-01
      • 2011-09-15
      • 2011-05-09
      • 1970-01-01
      • 2012-08-16
      相关资源
      最近更新 更多