Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by P.T. on May 05, 2009 00:17
open dhtmlx forum
Filtering a treegrid on the node and the leaf

I'm currently working with a treegrid and it will hold my relations and their contacts.
but when i search for a contact i can filter them but when i search for a relation i can't filter since they disappear.
is there a way to filter both of them.

so that i can search on both my relations and my contacts in 1 treegrid.

so
- Test company
- Paul T. (0123) 4567890 paul.t@email.com
- Test factory
- John T. (0123) 4567890 john.t@email.com

searching for john results in seeing
- Test factory
- John T. (0123) 4567890 john.t@email.com

searching for paul results in
- Test company
- Paul T. (0123) 4567890 paul.t@email.com

searching for test or factory results in
<nothingness>
Answer posted by Alex (support) on May 05, 2009 04:36

By default filtering affects olny the last level of treegrid.

If the company name is the 1st level of hierarchy, you can try to apply the following method:

grid.setFiltrationLevel(0);

Please, see details in the article http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Filtering_in_TreeGrid.html
 

Answer posted by P.T. on May 05, 2009 04:52

When i change the filtration level to 0 i can search for the parent nodes.

But then i can't search for the contacts under it.

I want to be able to search on both.

filtrationlevel -2 doesn't show me anything at all.

 

If i search for the company i want it to show the company + the contacts

if i search for a contact i want it to show the corresponding contacts + their parent companies.

Answer posted by Alex (support) on May 05, 2009 05:40

Unfortunately, it is not possible to achieve both of the requirements using #text_filter in one column.

There are several possible ways that you can use. The examples of two of them:

1) using 2 columns with #text_filter for each of them:

- company (tree),

- contacts

for example:

...
 <row id="1">
  <cell>Test company</cell>
  <cell></cell>
  <row id="1.1">
  <cell></cell>
  <cell>Paul T. (0123) 4567890 paul.t@email.com</cell>
  </row>
  <row id="2.1">
  <cell></cell>
  <cell>Paul T. (0123) 4567890 paul.t@email.com</cell>
  </row>
 </row>
...
2) custom filter function (filterBy) instead of #text_filter: dhtmlxGrid/doc/articles/Data_filtering_search.html; here you can compare userdata of the rows (there can be two userdata tags company and contact);

Answer posted by P.T. on May 06, 2009 00:23

They already were in seperate collumns but somehow when i go for either level -2 -1 0 1 or 2 one of them disappears when i search for the opposite

or they both disappear.

and ofcourse when the parent disappears they both disappear.

Answer posted by Alex (support) on May 06, 2009 02:00

Hello, 

sorry for the misleading information. Two text_filter also don't solve the issue. 

We have sent you the example of possible custom filtering function by email.

 

Answer posted by P.T. on May 06, 2009 02:16
Thanks :)
Answer posted by E. López on Dec 03, 2009 03:35
Hi, I'm having the same problem here.
Is there a way that you can post the filtering function here?
I'd appreciate that.

Answer posted by Alex (support) on Dec 03, 2009 05:06

Hello,

please contact us at support@dhtmlx.com to get the sample (this is PRO functionality and requires license).