function clickme() {
var treeObj = $("#TreeGridContainer").data("ejTreeGrid");
//To refresh TreeGrid with new datasource
treeObj.setModel({“dataSource": refreshedData});
} |
<button onclick="clickme()" style="margin-bottom:10px">Refresh TreeGrid</button>
<script type="text/javascript">
function clickme() {
var treeObj = $("#TreeGridContainer").data("ejTreeGrid");
//To refresh TreeGrid with new datasource
treeObj.setModel({ "dataSource": refreshedData });
var indexValue = treeObj.model.selectedRowIndex;
treeObj.model.selectedRowIndex = -1;
treeObj.setModel({ "selectedRowIndex": indexValue });
}
</script> |
<script type="text/javascript">
refreshedData = [{
taskID: 1,
taskName: "Planning",
isExpanded:false,
//..
},
{
taskID: 6,
taskName: "Parent Task 2",
isExpanded: true,
//..
}];
$(function () {
$("#TreeGridContainer").ejTreeGrid({
dataSource: projectData,
expandStateMapping: "isExpanded",
//..
})
});
</script> |