my model is multiple columns, the first column being a tree and let’s say the remaining columns A, B and C. the tree is very large - 25,000 nodes and is provided to dhtmlx as a json model. certain nodes in the tree have data in columns A, B and/or C (which is visible). this data may not necessarily be on leaf nodes or at the same depth within the tree. our filtration level is set to -2.
i have a requirement to filter the tree by a value that could appear in column A, B or C. the result of filtering is to display of the nodes that have a matching value, all of their descendants (which may not have a value in column A, B or C) and of course their ancestors.
it appears i’m currently unable to use the filterTreeBy() method. one, it only supports filtering on one column or it "AND"s the multiple columns. two, the value i’m filtering on isn’t necessarily in the column of leaf nodes.
currently, i’m filtering by calling myGrid.forEachRow(myFunc) where myFunc is ascertaining if a row should be shown / hidden and calling myGrid.setRowHidden() passing in false or true, respectively.
for the number of nodes i have in the TOC, this takes 8 minutes which is unacceptable. most / all of this time is spent by the dhtmlx code, specifically getRowById() as opposed to the logic we’ve written that does the ascertaining if a row should be shown / hidden.
so, i’m really looking for some ideas that might help me achieve what i need to achieve (filtering) with acceptable performance. i’m also in a spot where i’m limited to the types of changes i can make. for example, i must load the entire json / tree model. i don’t have the option to load a portion of the tree. perhaps in the future, i’ll be able to make a major design change. lastly, i have to be considerate about how much data i add to the json model. it is already a considerable size and an increase in size increases the performance hit for downloading / parsing the model itself.
some of my thoughts…
-
is there a way to show/hide rows faster than i’m currently doing it (e.g., call X instead of setRowHidden)
-
loading the entire tree is pretty fast. is there a flag i can add to my json model such that i can iterate over it, set a flag for hidden rows and then reload the entire tree but have the grid pick up on the fact that some rows should not be shown.
-
i’ve seen some documentation that suggests filterTreeBy() can take a customized function but not too much detail past that. does the dhtmlx code pass this function the rowid? if using this function is fast, i can use the rowid to determine if the node should be shown / hidden.
other ideas?
thanks a million!
kelly