need ideas to improve performance of filtering

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…

  1. is there a way to show/hide rows faster than i’m currently doing it (e.g., call X instead of setRowHidden)

  2. 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.

  3. 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

It’s better to use server side filtering. In such case only those rows will be loaded on the client side which should be displayed to the user. Please find tutorial here docs.dhtmlx.com/doku.php?id=dhtm … parameters

while i agree, that is not an option for me at this moment. the data in the tree serves as a client-side data model for more than just the tree and it would take a lot more time than i have to re-architect the application to remove this dependency. if i had the time? yes, i’d do just that.

to close this post, i want to report i was able to achieve what i wanted by using filterTreeBy and passing it a function vs. string to filter on. i learned dhtmlx gives the function 2 params - value in the column for the node in question and its rowid. the latter is the piece of information i needed to then look in my cross-reference table and determine if the row should be shown/hidden.

thanks!