Filtering subtasks with ej.Query

Hi,

I want to filter my data by some properties, so I use ejQuery's where clause to do it. Like this:

me.query = new ej.Query().where(new ej.Predicate("prod_order_reference", ej.FilterOperators.contains, $('#filterHighlightTextOp').val(), true)
.or("item_reference", ej.FilterOperators.contains, $('#filterHighlightTextOp').val(), true)
.or("item_name", ej.FilterOperators.contains, $('#filterHighlightTextOp').val(), true)
.or("customer", ej.FilterOperators.contains, $('#filterHighlightTextOp').val(), true)
.or("sale_order", ej.FilterOperators.contains, $('#filterHighlightTextOp').val(), true));

Doing it this way it only filters the first level of the data structure, but it doesn't filter the subtasks of a task. 
For example, in the ej.Predicate, it first check the if "prod_order_reference" property contains a value. I want to check this in the parent task and in every child subtask, but it does only in the parent one.

How could I do this?

Thanks.

1 Reply

JD Jayakumar Duraisamy Syncfusion Team January 23, 2019 11:45 AM UTC

Hi Oscar, 
We have analyzed the reported query.  The reported issue may due to applying “ej.Query()” on a hierarchical data. To filter all the required records, we recommend self-reference data source. And using “filterSettings” property we can filter required columns on load time. 
Please find the code example below: 
[ts] 
this.filterSettings = { 
                       filteredColumns: [{ 
                           value: "5", 
                           field: "TaskName", 
                           operator: "contains", 
                            predicate: "or" 
                       }, 
                      { 
                        value: "1", 
                        field: "TaskName", 
                        operator: "contains", 
                        predicate: "or" 
                    }] 
                   } 
 
[html] 
<ej-gantt id="GanttControl"  
       //.. 
[filterSettings]="filterSettings"> 
</ej-gantt> 
 
We have also prepared the sample based on this. Please find the sample from below location 
 
Please let us know if you need further reference on this. 
Regards, 
Jayakumar D 


Loader.
Up arrow icon