Categories | Question details Back To List | ||
dhtmlxtreegrid filter - display children of matching rows Hi, We are using your dhtmlx treegrid for a while now and it works well. When a user enters search terms that the matching entries are displayed correctly along it's parents. We would like to also display the children of the matching rows but they should be collapsed by default. Currently we are using expandAll to expand all of the entries in the onFilterEnd. So we would also need be able to only expand up to the matching entries. Partially the function setFiltrationLevel might be useful but I'm unsure how it should be used. Could you please advise? Thank you very much in advance Daniel Answer posted by Alex (support) on Dec 18, 2009 07:19 Hello, >> When a user enters search terms that the matching entries are displayed correctly along it's parents. #text_search behaves as you described by default. Please have a look at the sample: http://dhtmlx.com/docs/products/dhtmlxTreeGrid/samples/04_grid_operations/02_treegrid_filtering.html If you have created custom filter, you can use openItem method for the matching rows instead of expandAll. Answer posted by Daniel on Jan 11, 2010 10:12 Hi Alex, Thank you for your quick response and Happy New Year. (And apologies for the delay, due to the Christmas holiday) It seems that the display of the children works like you say for when I filter by the second level. But if I want to filter by all of the levels (I'm passing in -2) then this doesn't work anymore. The children are not displayed anymore. (I also played around with the two additional parameters but I'm either getting JavaScript errors or not the desired display) I don't have a custom filter. All I'm doing currently is expanding the result after the filter has been performed. To expand only matching rows (and the parents thereof) I'd would need to know which the matching rows are (because I don't want to expand the non-matching children - but I do want to be exandable). Thank you for your help. Daniel Answer posted by Stanislav (support) on Jan 12, 2010 04:19 If you filter "by all level" - it means that child's of filtered item will be filtered as well and removed if they are not confirm filtering logic. There are two possible modes a) filter by all level - all items are filtered and you can't control this process b) filter by some level - in such case you can define fixed level and be sure that child items on lower level will be preserved >>I'd would need to know which the matching rows are Instead of filtering you can use findCell command and locate all rows which are confirm to your requirements. Command will return a list of id,index pairs, so you will be able to expand the necessary branches, or add any other custom logic. |