Results 1 to 4 of 4

Thread: How to filter an Asynch TreeGrid ?

  1. #1

    Default How to filter an Asynch TreeGrid ?

    Hello,

    I have a tree which is open in a certain state and I want to filter it using the applyFilters method from the TreeStore.
    • 1st try : calling applyFilter on a stateLess tree (stateful set to false)
      The filter goes into each element and set the "filtered" property correctly, then thru the onDataChanged method of the TreeGrid, all elements get removed except the root element.
      As a result : only root element is displayed and clicking on it doesn't even expand the node

    • 2nd try : calling applyFilter on a stateFul tree (stateful set to true)
      As a result I have a stakeoverflow due to infinite loop between setExpanded called by statefulExpand method causing again a loadChildren (line 468) catch by the OnLoad on the tree store which detects at this time the filter (line 788) and so call ApplyFilter again.


    Here I cannot use the tip of "intercepting BeforeExpand", as this event is not fired.
    I've seen also a variable called filtering line 125 - TreeGrid - which is never changed but used line 463, maybe passing this as parameter of setExpanded can solve the problem in case of stateful tree ?


    I'm using GXT 2.2.0 release.

    Any clue or workaround would be appreciated

  2. #2
    Sencha User
    Join Date
    Sep 2011
    Posts
    2

    Default

    Hi,
    Did you get some answer, solution or workaround? I'm now stuck on exactly the same problem.

    Thanks by advance,

    Arcadien

  3. #3

    Default

    Yes, I did

    Here is the trick :

    Just after injecting the TreeModel in your view (and so your treeStore) you have to
    1. clear the filters
    2. Expand all your tree
    3. then apply again your filter
    In that way you will have something consistent in terms of filtering options after a (re) load

    Code:
    // ... load here your tree model 
    boolean wasFiltered = treeStore.isFiltered();
    if (wasFiltered)
        treeStore.clearStoreFilters();
    tree.expandAll();
    if (wasFiltered)
        treeStore.applyFilter(null);

  4. #4
    Sencha Premium Member
    Join Date
    Nov 2010
    Posts
    43

    Default

    How can i know that complete tree is expanded? When we call immediately after the expandall method.

    It doesn't work for me

    Thanks in advance

Similar Threads

  1. Asynch Tree & Filters
    By Gordon25 in forum Ext GWT: Discussion
    Replies: 27
    Last Post: 17 May 2011, 12:36 AM
  2. Async TreeGrid + Filter
    By sarsipius in forum Ext GWT: Discussion
    Replies: 3
    Last Post: 28 Jul 2010, 4:33 AM
  3. TreeGrid + Filter Field not expanding results
    By bboyle18 in forum Ext GWT: Discussion
    Replies: 12
    Last Post: 26 Feb 2010, 4:27 AM
  4. Asynch TreePanel using Http Request
    By p.vongphrchanh in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 8 Dec 2009, 2:09 PM
  5. Expand the branch of an asynch loaded tree
    By Limey in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 7 Jul 2009, 5:09 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •