1. #1
    Ext User
    Join Date
    Aug 2010
    Posts
    12
    Vote Rating
    0
    richardcatlin is on a distinguished road

      0  

    Default Possible to selectively render Nodes in a TreePanel with TreeStore<BaseTreeModel>

    Possible to selectively render Nodes in a TreePanel with TreeStore<BaseTreeModel>


    How can I selectively show TreeNodes in the TreePanel from a TreeStore?

    Is it possible to add a Property to BaseTreeModel, such as a boolean render, such that the TreePanel will hide or show the Node?

    Thank you.
    Richard Catlin

  2. #2
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    870
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default


    Hi.
    You can use a StoreFilter for this.
    Take a look in its definition.
    Basically, you just need to implement the select method.
    Return true for the nodes you want to show, and false for the ones you want to hide.

    Hope this helps you.

    Regards,
    Michel.

  3. #3
    Ext User
    Join Date
    Aug 2010
    Posts
    12
    Vote Rating
    0
    richardcatlin is on a distinguished road

      0  

    Default


    Thanks. That works. Here's the code for others with the same problem.
    StoreFilter<BaseTreeModel> storeFilter = new StoreFilter<BaseTreeModel>() {
    @Override
    public boolean select(Store<BaseTreeModel> store, BaseTreeModel parent, BaseTreeModel item, String property) {
    Boolean render = item.get("render");
    return render;
    }
    };
    store1.addFilter(storeFilter);
    store1.applyFilters(null);

Similar Threads

  1. Adding TreeModel objects to Tree/TreeStore - BaseTreeModel not updated
    By danny.robinson in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 19 May 2009, 7:14 AM
  2. TreeStore and BaseTreeModel have not the same treeStructure, why?
    By jeanmonod in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 21 Jan 2009, 4:28 AM

Thread Participants: 1

Tags for this Thread