I am using Kendo TreeList to display hierarchical data. Application allows user to add new rows to the displayed data, or edit existing ones. I am not using inline editing. Right now I add new rows by this piece of code:
treeList.dataSource.data().push(vm);
And if user edited some row, it is updated in dataSource:
for (i = 0; i < dsData.length; i++) {
if (dsData[i].get("TaskUid") === vm.get("TaskUid")) {
dsData[i] = vm;
var curId = vm.get("VisualId");
vm.set("VisualId", curId);
grid.dataSource.read();
onDataBound();
}
}
There is a side effect - upon calling dataSource.read() newly added items disappear from the TreeList control. Question is - how am I supposed to add data and refresh data in treeList without such a side effect?
Probably you should consider to use
dataSource.pushCreate
to add new element to the dataSource anddataSource.pushUpdate
to edit existing element inside the dataSourceI copy some example of basic dropdownlist, and add 3 button
Do it like this :