Apr 30, 2015, 6:37 PM
Clearing TreePanel filter causes inner nodes to move to a different parent node
Hi,
After copying the sample from the example page to my app I noticed something strange, even though the filter works fine when I clear it the nodes which were contained within several different groups will now display inside just one group which happens to be the last one. By expanding the empty groups which used to contain the nodes before clearing the filter fixes the problem, it seems that when I expand them the tree panel realizes that there were nodes there which are in the wrong place and moves them back in place.
Here's my code:
After copying the sample from the example page to my app I noticed something strange, even though the filter works fine when I clear it the nodes which were contained within several different groups will now display inside just one group which happens to be the last one. By expanding the empty groups which used to contain the nodes before clearing the filter fixes the problem, it seems that when I expand them the tree panel realizes that there were nodes there which are in the wrong place and moves them back in place.
Here's my code:
var FilterItems= function (sender, e)
{
var tree = App.MyTree,
store = tree.store,
logic = tree;
//Here's where the problem lines, the second time that this gets called
//the nodes will all move from their own parent node to the last parent node on the tree.
logic.clearFilter();
//The sender is a check box, if checked we apply the filter
if (sender.getValue())
{
logic.filterBy(function (node)
{
//This is a custom attribute that I add to the nodes on the code behind,
//it works no problem
return node.data.status== "on";
});
}
};
var clearFilter = function ()
{
var tree = App.MyTree,
store = tree.store,
logic = tree;
logic.clearFilter(true);
tree.getView().focus();
};
Last edited by paul-2011; Apr 30, 2015 at 6:43 PM.