Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Filtering TreeGrid with local data

    Hello,

    I have some problems with filtering TreeGrid based on this example

    Filtering is working, BUT it's filtering only folders - all nodes (which don't match criteria) are still there. For example, imagine this structure:
    -Folder A
    |-Folder A1
    ||-Node X1
    ||-Node X2
    |-Node Y
    -Folder B
    |-Node Z

    When I apply filter for name "Node X1", I need to show only node with that name + its parent(s) (path). Current solution will hide "Folder B" (OK, that's good), shows Folder A and Folder A1 (ok, parent folders for selected node), but also all nodes from that folders.
    In "matchingNodes" I have only desired nodes (3) so filtering is OK, but setting this nodes as data don't clear old nodes. getData().getAllNodes().length is allways 7 even if I try setData(new Tree()) or getData().remove(getData().getRoot()).
    Any suggestions?

    (SmartGWT 3.1p, GWT 2.5, Firefox 16.0.2)

    EDIT: There is one difference between example and my code:
    - I am filling tree with: tree.linkNodes(nodes) after treeGrid was created and filled with empty Tree
    - Example code will create tree, set data to this tree and then use this tree to create TreeGrid
    Can be problem here? linkNodes vs. setData
    Last edited by mi0; 23 Nov 2012, 02:48.

    #2
    Mea culpa for stupid thread/question :S In filter result I was showing original nodes with all children. Creating copy of TreeNodes (without children) into "matchingNodes" solved my problems...

    Comment

    Working...
    X