Our state of the art Gantt chart
Hello,
We want to use the "convertEmptyParentToLeaf" property, where exactly we can use this after loading data from API
thanks
Thank you, Mat,
We added the "convertEmptyParentToLeaf " property in the Backend response model as well as the front-end Task model but changes can't reflect.
there any other place that needs to be change?
Ok it's not a back end flag. You need to change the Task Model you use. Use basic JS imports:
import TaskModel from '../../lib/Gantt/model/TaskModel.js';
TaskModel.convertEmptyParentToLeaf = false;
Please see below screenshot
image (4).png (121.13 KiB) Viewed 522 times
Do you mean this one?
image (5).png (75.86 KiB) Viewed 521 times
also we set TaskModel.convertEmptyParentToLeaf = false; in above screen shot
it also won't work
Yes but put it on your class Task
. Also, why do you redefine all the default fields we have declared? It makes no sense to redefined those fields and use 'dataSource' like that. Use dataSource
when you want to map a data field to another property in your data object.
we added in our task class which extending the task model, Still it's not converting in leaf.
Just tried this in our basic
sample, works great - please try it:
new Gantt({
appendTo : 'container',
project,
dependencyIdField : 'sequenceNumber',
columns : [
{ type : 'name', width : 250 }
],
// Custom task content, display task name on child tasks
taskRenderer({ taskRecord }) {
if (taskRecord.isLeaf && !taskRecord.isMilestone) {
return taskRecord.name;
}
}
});
project.taskModelClass.convertEmptyParentToLeaf = false;
Yes, it's working mats on removed all children parent is converted into leaf
now one more query how we can convert into leaf on load by default if there no children,
basically, this is the main goal we have been trying on this