Hello Here,
I have an issue on renaming a filename in Export Excel file with Brytum Gantt.
I'm export a file with the default filename they used in this feature, means my predefined name it's not working.
Look the whole codes here.
import { Gantt, ProjectModel } from "../build-gantt/build/gantt.module.js";
const project = new ProjectModel({
autoSync : true,
transport : {
load : {
url: '../assets/build-gantt/_datasets/launch-saas.json'
},
sync : {
url : 'https://localhost:8080/api/v1/task/sync'
}
},
autoLoad : true,
autoCalculatePercentDoneForParentTasks:false,
// The State TrackingManager which the UndoRedo widget in the toolbar uses
stm : {
autoRecord : true
}
});
const gantt = new Gantt({
project : project,
columns: [
{ type : 'wbs' },
{ type: 'name', field: 'name', text: 'Name' },
{ type: 'startdate' , text: 'StartDate' },
{ type: 'duration', text: 'Duration' },
{ type : 'resourceassignment', width : 120, showAvatars : true },
{ type: 'percentdone', text: 'Percentdone', showCircle : true, width : 70},
{ type: 'predecessor', text: 'Predecessor' },
{ type : 'schedulingmodecolumn' },
{ type : 'calendar' },
{ type : 'date', text : 'Deadline', field : 'deadline' },
{ type: 'addnew', field: 'addnew', text: 'Addnew' },
],
style: 'font-size:0.85em',
autoHeight: true,
subGridConfigs: {
locked: { flex: 3 },
normal: { flex: 4 }
},
features: {
criticalPaths: true,
cellEdit : {
addNewAtEnd: false,
},
filter: true,
excelExporter : {
filename : 'Project Export in Excel',
// Choose the date format for date fields
dateFormat : 'YYYY-MM-DD HH:mm'
}
},
dependencyIdField : 'wbsCode',
tbar: {
items: [
{
type : 'button',
text : 'Export as .xslx',
ref : 'excelExportBtn',
icon : 'b-fa-file-export',
onAction : () => {
const filename = gantt.project.taskStore.first && gantt.project.taskStore.first.name;
gantt.features.excelExporter.export({
filename
});
}
}
]
},
appendTo: document.getElementById('granttId')
});
Is there any help/hint you may give me, to export an Excel file with the filename i want ?