The onRowCreate event handler fires when new row text is submitted in the JavaScript Gantt Chart, before the default action specified by rowCreateHandling.
DayPilot.Gantt.onRowCreate(args)args.text (string) - new text submitted by the user
args.preventDefault() - prevents the default action specified by rowCreateHandling
Use args.preventDefault() when you need to validate or replace the default action configured by rowCreateHandling. The corresponding onRowCreated event fires after that default action completes.
JavaScript
const gantt = new DayPilot.Gantt("dp", {
onRowCreate: (args) => {
if (!args.text.trim()) {
args.preventDefault();
}
},
// ...
});
gantt.init();Angular
<daypilot-gantt [config]="config"></daypilot-gantt>config: DayPilot.GanttConfig = {
onRowCreate: (args) => {
if (!args.text.trim()) {
args.preventDefault();
}
},
// ...
};React
<DayPilotGantt
onRowCreate={onRowCreate}
{/* ... */}
/>const onRowCreate = (args) => {
if (!args.text.trim()) {
args.preventDefault();
}
};Vue
<DayPilotGantt
@rowCreate="onRowCreate"
<!-- ... -->
/>const onRowCreate = (args) => {
if (!args.text.trim()) {
args.preventDefault();
}
};