Is there a way to grab task list after filter has been applied?
So using onBeforeTaskDisplay allows me to perform some filtering and such before it is displayed.
But I’ll like to know what’s task list at the end of the filter.
So I can get like
gantt.getAllTaskAfterFilter() which returns me the list of the tasks.
// Update:
Alternatively, maybe have an event that is like gantt.getAllTaskAfterRefreshData(), may work for me as well, but need to test it out.
To get rendered tasks after the filter has been applied, you should use eachTask() method to iterate over tasks and check the value of the task object property to which filtering is applied. https://docs.dhtmlx.com/gantt/api__gantt_eachtask.html
Find the function getAllDisplayedEvs() in the code that pushes displayed tasks to the filteredTasks array. You need similar solution to implement such functionality in your application.
It looks good to me at the moment but I’ll have to try it out to know.
Just to understand correctly, calling gantt.refreshData() will trigger both onBeforeTaskDisplay and onDataRender sequentially or is that gantt.refreshData() triggers onBeforeTaskDisplay which then triggers onDataRender?
Also, it is basically running the logic for filter twice, one for onBeforeTaskDisplay, and another one looping through each task to push to the array. Would it be expensive to do so if there is quite a number of tasks, and filter can be easily changed and applied every now and then.
Sequentially.
refreshData calls onDataRenderhttp://prntscr.com/ozokal onBeforeTaskDisplay fires for each rendered event (several times according to numbers of events in data) before onDataRender (this event fire only once in the end).
This is unlikely to affect performance. I can’t say the number of tasks when you may encounter this problem. But it should be high enough.
I would love to use refreshData but there seem to have some rendering issue when using refreshData, hence, I might be force to use render at the moment until a suitable resolution is found.
That’s another issue that I’ve filed, and currently in talk with @ramil.
I will test out your suggestion, and feedback here if there is anything.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan