The onRowSelect event handler fires when the user selects or deselects a row in the Gantt Chart, before the default action specified by rowSelectHandling.
Row selecting must be enabled by mapping a selected user action to "Select", for example using rowClickHandling or rowDoubleClickHandling.
The default action can be canceled by calling args.preventDefault().
DayPilot.Gantt.onRowSelect(args)args.task - DayPilot.Task object representing the task.
args.selected (boolean) - true if the new state is selected, false if the row is being deselected.
args.ctrl (boolean) - true if the Ctrl key was pressed.
args.shift (boolean) - true if the Shift key was pressed.
args.preventDefault() - cancels the default action.
JavaScript
const gantt = new DayPilot.Gantt("dp", {
rowClickHandling: "Select",
rowSelectHandling: "Update",
onRowSelect: (args) => {
if (args.selected) {
DayPilot.Modal.alert("Selected: " + args.task.text());
}
},
// ...
});
gantt.init();Angular
<daypilot-gantt [config]="config"></daypilot-gantt>config: DayPilot.GanttConfig = {
rowClickHandling: "Select",
rowSelectHandling: "Update",
onRowSelect: args => {
if (args.selected) {
DayPilot.Modal.alert("Selected: " + args.task.text());
}
},
// ...
};React
<DayPilotGantt
rowClickHandling="Select"
rowSelectHandling="Update"
onRowSelect={onRowSelect}
{/* ... */}
/>const onRowSelect = (args) => {
if (args.selected) {
DayPilot.Modal.alert("Selected: " + args.task.text());
}
};Vue
<DayPilotGantt
rowClickHandling="Select"
rowSelectHandling="Update"
@rowSelect="onRowSelect"
<!-- ... -->
/>const onRowSelect = (args) => {
if (args.selected) {
DayPilot.Modal.alert("Selected: " + args.task.text());
}
};