Category / Section
How to refresh a row without refreshing the data source
1 min read
There may be an instance, where we need to refresh a specific row instead of refreshing the entire data source, and it is possible in TreeGrid using refreshRow method.
The below code snippet explains refreshing a specific row in TreeGrid with the changes in a column value using the row index.
<script> function rowRefresh() { //To get the value entered in TextBox var textName = $('#refreshedTaskName').val(), textIndex = $('#indexSelected').val(), treeObj = $("#TreeGridContainer").data("ejTreeGrid"), updatedRecords = treeObj.model.updatedRecords; //To retrieve the required row from updated records itemToUpdate = updatedRecords[textIndex]; if (itemToUpdate) { //To refresh the required record itemToUpdate.taskName = itemToUpdate.item.taskName = textName; treeObj.refreshRow(textIndex); } else { alert("Enter a valid Index"); } } </script>
Click here to find the sample for the above scenario.