Premium support for our pure JavaScript UI components


Post by tasnim »

Hi,

Yeah, You couldn't change the name it's mentioned in the docs the link I provided above

A callback function or a set of name: value properties to apply on tasks created using the task context menu. Be aware that name value will be ignored since it's auto-generated and may be configured with localization.

To change the task name you could use the https://bryntum.com/products/gantt/docs/api/Gantt/feature/TaskMenu feature for this

    features : {
        taskMenu : {
            items : {
                add : {
                    menu : {
                        addTaskBelow : {
                            onItem({ source : gantt, taskRecord }) {
                                gantt.addTaskBelow(taskRecord, { data : { name : 'My custom name' } });
                                console.log('works');
                            }
                        }
                    }
                }
            }
        }
    }

Post by sprabhu »

Also how can we access the newly added row in the after task event? do we have after add event like we have beforeEventAdd?


Post by tasnim »

I believe you're looking for https://bryntum.com/products/gantt/docs/api/Gantt/data/TaskStore#event-add

gantt.project.taskStore.on('add', (props) => console.log(props))

Post by sprabhu »

Any update on this how to default the Name as null instead of 'New task'?


Post by arcady »

addTaskBelow allows to pass the added task data like this:

const newRecord = gantt.addTaskBelow(someTask, {
    data : { name : 'custom name' }
})

docs: https://www.bryntum.com/products/gantt/docs/api/Gantt/view/GanttBase#function-addTaskBelow


Post Reply