开发者

expand JSF tree through Javascript

开发者 https://www.devze.com 2023-03-13 14:44 出处:网络
I have a functional trinidad tree . I want to expand the tree when the page is loaded. <tr:tree id=\"treeid\"value=\"#{backingbean.model}\" var=\"model\">

I have a functional trinidad tree . I want to expand the tree when the page is loaded.

<tr:tree id="treeid"  value="#{backingbean.model}" var="model">
...
</tr:tree>

I am calling the following JS function on page load.

 function opentree() {
     document.getElementById('treefo开发者_如何转开发rm:treeid').click();
 }

Though the JS function is triggered , it doesn't expand the tree. I believe I shouldn't be using click() for a tree node. Any idea how to proceed....


I solved it this way:

In your BackingBean:

 public class BackingBean
 {
     RowKeySetImpl rowKeySet = new RowKeySetImpl();
     public BackingBean()
     { 
        super();
        rowKeySet.addAll();
     }

     public RowKeySetImpl getRowKeySet() {
       return rowKeySet;
       }

     public void setRowKeySet(RowKeySetImpl rowKeySet) {
       this.rowKeySet = rowKeySet;
       }
 }

In your page:

 <tr:tree id="treeid" var="model" value="#{backingBean.model}" disclosedRowKeys="#{backingBean.rowKeySet}">
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号