Scenario : add new blank row below selected row, then I enter some data into blank row.
Issue : I am getting blank data from above newly added row by using args.model.selectedItem.
$("#TreeGridContainer").ejTreeGrid({
dataSource: productArray,
childMapping: "children",
treeColumnIndex: 1,
isResponsive: true,
showColumnChooser: true,
allowSorting: true,
editSettings: {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
editMode: "rowEditing",
rowPosition: "belowSelectedRow"
},
columns: [
{ field: "Name", headerText: "Name" },
{ field: "Description", headerText: "Description" }
],
toolbarSettings: {
showToolbar: true,
toolbarItems: [
ej.TreeGrid.ToolbarItems.Add,
ej.TreeGrid.ToolbarItems.Edit,
ej.TreeGrid.ToolbarItems.Delete,
ej.TreeGrid.ToolbarItems.Update,
ej.TreeGrid.ToolbarItems.Cancel,
ej.TreeGrid.ToolbarItems.ExpandAll,
ej.TreeGrid.ToolbarItems.CollapseAll
]
},
//endEdit: function (args) {
// debugger
// if (args.columnName == 'Description')
// var data = args.data;
//},
toolbarClick: function (args) {
if (args.itemName == 'Update') {
debugger
var treegridObj = $("#TreeGridContainer").data("ejTreeGrid");
treegridObj._saveRow();
if (args.model.selectedItem.level == 0) {
args.model.selectedItem['Id'] = args.model.currentViewData[args.model.currentViewData.length - 1].Id + 1;
args.model.selectedItem.children = [];
}
treegridObj.addRow(args.model.selectedItem, ej.TreeGrid.RowPosition.Child);
}
}
})