Hi,
I want to add a dropdown in Gantt chart which will be consisting column names that would be multi-selectable checkboxes. On selection/deselection of the options in dropdown, the user should be able to add/remove columns selected from dropdown in the Gantt chart. Please help me know is there any way to achieve this functionality
Thanks @Monisha for the quick response. Actually, I want to have a dropdown that will add/remove columns as shown in below screenshot. Is it feasible?
<ejs-gantt
id="ganttDefault"
#gantt
height="430px"
[dataSource]="data"
[taskFields]="taskSettings"
[allowSelection]="true"
[labelSettings]="labelSettings"
height="400px"
[projectStartDate]="projectStartDate"
[projectEndDate]="projectEndDate"
[highlightWeekends]="true"
[columns]="columns"
[toolbar]="toolbar"
(dataBound)="dataBound($event)"
>
</ejs-gantt>
|
this.toolbar = [
{
tooltipText: 'Column chooser',
id: 'columnChooser',
}
];
public dataBound(args: any) {
if (this.flag) {
let selected: boolean = true;
let DropDownTreeObj = new DropDownTree({
fields: {
dataSource: this.dtreedata,
value: 'name',
text: 'name',
},
showCheckBox: true,
placeholder: 'Column Chooser',
popupWidth: '300px',
beforeOpen: function () {
if (selected) {
DropDownTreeObj.selectAll(true);
selected = false;
}
},
close: function (args) {
var gantt = (document.getElementById('ganttDefault') as any)
.ej2_instances[0];
var showColumns = [];
for (var i = 0; i < DropDownTreeObj.value.length; i++) {
showColumns.push(DropDownTreeObj.value[i]);
}
gantt.columns = showColumns;
},
});
DropDownTreeObj.appendTo('#columnChooser');
this.flag = false;
}
}
|
Thanks for the solution