开发者

expand JSF tree through Javascript

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜