Export only visible tasks

Hello there…

Actually, I have a list of tasks in the gantt, in that list I hide some of them according to an attribute. The issue comes when exporting to Excel or PDF, since all the tasks appear, even the ones that are not visible.

I hide the tasks by using the onBeforeTaskDisplay event.
What I need is to be able to export only the tasks that are visible. I tried to pass the attribute “data” in the function exportToExcel, but it does not show me the data.

Any idea?

Hello Erick,
If you want to export the data to PDF, you need to enable the raw: true parameter in the export function. Then you will get only filtered tasks in the exported file:

Here is an example:
http://snippet.dhtmlx.com/5/76cd8df1c

If you want to do that for Excel export, unfortunately, right now, there is no built-in way to do that. The dev team will add that feature in the future, but I cannot give you any ETA.

I have the following workarounds that might help you:

Generate a filtered dataset:
http://snippet.dhtmlx.com/5/e9fc573e4
Generate a filtered dataset, load it, export the data, restore the previous dataset:
http://snippet.dhtmlx.com/5/a12a8e068