Hobione's Weblog

Living & Breathing in Web 2.0 Era

ICEfaces: Open up one tree node only

I wanted to open up one tree node instead of the whole tree. Here is a screen shot that I wish to happen when application get initialized.  The key is, it should happens always in the third node in this case “IRM-2008-000021-A”.

ICEFaces Tree

ICEFaces Tree

I have tried this code, but noting seems to be happening.


 if (count == 2) {
    folderObject.setExpanded(true);
    this.showFirstDataSet();
    this.setCurrentSeletedFolderName(folder.getName());
 }

Solution: Here how we have tackled the issue. Couple things we have learned about ICEfaces tree.
1. By default it expend
s to true. So if I don’t set IceUserObject.setExpanded(false); tree nodes always will be opened.
2. If I want to open up only 3rd node, I have to explicitly set IceUserObject.setExpanded(true); for node 1 and 2.


if(count == 1){
                    folderObject.setExpanded(true);
                }else if (count == 2) {
                    this.showFirstDataSet();
                    this.setCurrentSeletedFolderName(folder.getName());
                }else{
                    folderObject.setExpanded(false);
                }

count == 1 will always open up the 3rd item from the list which will be the project folder of root.  So, here what I am saying, open up node #1 and node # 2 only and set other nodes close and here how it looks.

Tree

Tree

Advertisements

September 19, 2008 - Posted by | ICEfaces | ,

1 Comment »

  1. Hey Friend
    Can you provide code for this icefaces tree issue. I also want this feature in my project. It would be of great help

    Comment by karan | May 18, 2010 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: