Gantt Filtering questions

Hi,

I have two questions abour filtering in Gantt:
  1. In load event I can not call obj.filterContent(predicate); beacuse it throws an error pasted at the bottom of this post. But by the documentation I can set filter on load by setting model.filterSettings.filteredColumns. This is OK, but there comes to missmatch in required type. filteredColumns must be type of array and filterContent function acept type of ej.Predicate. So I wonder if there is possible to get required array for filteredColumns  from ej.Predicate type, or if is it possible to filter the gantt on load and dynamicly with same parameters?
  2. Is it possible to somehow also hide the parent rows, which do not match with the filtered rules after filtering? So for example from here: https://help.syncfusion.com/js/gantt/filtering#filtering-multiple-columns-dynamically there would not show tasks 1 and 7 since they do not match with filter restrictions (example of: Filtering multiple columns dynamically). So if there is any switch, where you could select show it with parents or not?


Error from point 1.: TypeError: Cannot read property 'model' of undefined
    at Object._refreshFilteredRecords (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports ...


Regards,
Marko


7 Replies

PE Punniyamoorthi Elangovan Syncfusion Team May 2, 2018 12:25 PM UTC

Hi Marko, 
 
Thank you for contacting Syncfusion support 
 
Query1: In load event I cannot call obj.filterContent(predicate); because it throws an error pasted at the bottom of this post.  
Answer: It is not possible to call the filterContent public method in the load client side event, but we can achieve your requirement with create client side event so we suggest you to call the filterContent public method in the create client side event. So you can call this method with same parameter both at initial load and dynamically. 
 
Query2: Is it possible to somehow also hide the parent rows, which do not match with the filtered rules after filtering? 
Answer:  After filtering, if the filtered record has parent record the filtered record will be displayed along with its parent records and this is the behavior of filtering in Gantt. 
 
Please let us know if you require further assistance on this. 
 
Regards, 
Punniyamoorthi 



MA Marko May 2, 2018 02:23 PM UTC

Hi,

thank you for your answers.
On point 1: I have created binding to create event: (create)="create($event)" and also made function:
create(args){
        console.log("create");
        let ganttObj = $("#GanttControl").ejGantt("instance");
        let predicate = ej.Predicate("id", ej.FilterOperators.equal, 2, true);
        ganttObj.filterContent(predicate);
    }

but still I get the following problem in my console:
create
AppComponent.html:1 ERROR TypeError: Cannot read property 'model' of undefined
    at Object._refreshFilteredRecords (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:20), <anonymous>:10:4888427)
    at Object.filterContent (eval at webpackJsonp.../../../../script-loader/addScript.js.module.exports (addScript.js:20), <anonymous>:10:4888756)
    at AppComponent.webpackJsonp.../../../../../src/app/app.component.ts.AppComponent.create (app.component.ts:41)
    at Object.eval [as handleEvent] (AppComponent.html:41)
    at handleEvent (core.es5.js:11998)
    at callWithDebugContext (core.es5.js:13467)
    at Object.debugHandleEvent [as handleEvent] (core.es5.js:13055)
    at dispatchEvent (core.es5.js:8614)
    at core.es5.js:10770
    at SafeSubscriber.schedulerFn [as _next] (core.es5.js:3647)

I have also prepared an example of this error and attached it here.

Regards,
Marko

Attachment: gantt_9de1640e.zip


PE Punniyamoorthi Elangovan Syncfusion Team May 3, 2018 02:33 PM UTC

 Hi Marko, 
Regret for the inconvenience caused. 
We can able to reproduce your reported issue with the attached sample, currently we are checking on this issue at our end with highest priority. Meanwhile we have prepared another application with Gantt and the reported issue is not reproduced in this sample.  
Please find the sample link below for your reference 
Regards, 
Punniyamoorthi 




MA Marko May 3, 2018 08:26 PM UTC

Hi,

thank you for your fast response and priority check.
In your example you do not set dataSource as DataManager type, which dosen't work well for me since bug report 191330, where you response to me was:
"In self-reference data binding we can’t insert the record in proper position due to parent child relationship but in hierarchical data source we can insert in proper position, so this issue will not occurred in hierarchical data source. We can overcome this issue by passing data source as instance of ejDataManager object instead of JSON object to Gantt control."

I found other temperary solution, but I am not felling good about it beacuse it is async, but for now it works. I have the following in my create method:
setTimeout(function() {
ganttObj.filterContent(predicate);
}, 400);
I would be glad, if you could suggest any better solution.

Regards,
Marko


PE Punniyamoorthi Elangovan Syncfusion Team May 7, 2018 12:00 PM UTC

Hi Marko, 
Apologize for the delay. 
We suggest you to call the filterContent method within the actionComplete client side event, if the data source for the Gantt is a datamanager instance. Please refer the below code snippet. 
[TS] 
actionComplete(args) { 
        if (args.requestType == "create") { 
            var ganttObject = $("#GanttControl").ejGantt("instance"); 
        var predicate = ej.Predicate("taskName", ej.FilterOperators.equal, "Plan budget", true); 
        ganttObject.filterContent(predicate); 
        } 
    } 
If we call the method in create or load events with datamanager instance as Gantt datasource, the Gantt will be rendered asynchronously and hence the Gantt instance will not be created within these events. 
We have prepared the sample for your reference please find the sample link below. 
Please let us know if you require further assistance on this 
Regards, 
Punniyamoorthi 



MA Marko May 8, 2018 08:44 AM UTC

Hi,

thank you for your response. The shown example is working well for me.
Thank you again for your help.

Regards,
Marko


PE Punniyamoorthi Elangovan Syncfusion Team May 9, 2018 02:02 PM UTC

Hi Marko,  
Thank you for your update 
Please let us know, if you require any further assistance on this. 
Regards, 
Punniyamoorthi 



Loader.
Up arrow icon