PrimeFaces Tree component, setting selected node from managed bean

前端 未结 7 2295
南旧
南旧 2020-12-18 20:27

I\'m running Primefaces 3.2 and JSF 2.0 on Glassfish 3.

I\'ve tried a lot, to programatically set the selected node from a managed bean. That includes setting the se

7条回答
  •  鱼传尺愫
    2020-12-18 21:13

    for me none of the above worked. because from what I see in the console, the child nodes don't have any ids let alone any row key number so I used jQuery advanced class selector with the help of the rowKey attribute so I had to use

    String script = "PF('treeSingleWidget').selectNode($(\"td[data-rowkey='" + selectedNode.getRowKey() + "']\"))";
    Primefaces.current().executeScript(script);
    

提交回复
热议问题