toolbarClick: function (args) {
if (args.itemName == "CustomAdd") {
if (args.model.selectedItem) {
var selectedItem = $.extend(true, {}, args.model.selectedItem.item);
selectedItem.taskID = parseInt(selectedItem.taskID) + 1;
if (!args.model.selectedItem.hasChildRecords && ej.isNullOrUndefined(args.model.selectedItem.parentItem))
this.addRow(selectedItem, ej.TreeGrid.RowPosition.Child);
else {
this.addRow(selectedItem, ej.TreeGrid.RowPosition.Top);
}
}
else {
this.addRow({ taskID: 40, taskName: "New Task 40", startDate: "2/20/2014", endDate: "2/25/2014" });
}
}
}, |
create: function (args) {
var toolbar = $("#TreeGridContainer_toolbarItems");
//to append custom item as first toolbar element
$(toolbar).append($(toolbar).children().get().reverse());
} |