JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Gantt › Export Gantt › Reply To: Export Gantt
April 21, 2021 at 3:58 pm
#101724
yavordashew
Member
Hi Walter,
Let me give you a solution that my suit your needs.
If you want to add new task columns when export the Gantt chart you can do so by pushing new task column object to the taskColumns array.
I have prepared a little code example to showcase you this functionality:
//In your HTML file:
<smart-gantt-chart view="day"></smart-gantt-chart>
<div class="option">
<smart-button id="exportToPDF">Export to PDF</smart-button>
</div>
//In your Js file:
let newTaskColumn = {
label: 'Date End',
value: 'dateEnd',
size: '25%',
min: '20%'
};
const ganttChart = document.querySelector('smart-gantt-chart');
document.getElementById('exportToPDF').addEventListener('click', function (event) {
ganttChart.taskColumns.push(newTaskColumn);
ganttChart.refresh(true,false);
ganttChart.exportData('pdf');
});
Let me know if that works for you.
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/