Unfortunately the problem cannot be reconstructed locally. Please, provide with a complete demo, or share with demo link, where the problem could a be reconstructed locally.
Here you can find a tutorial about creating a complete demo: docs.dhtmlx.com/tutorials__auxi … pport.html
For the first issue, How to clear the contents of tree view before binding ? I used
and it worked for me.
The data to bind is from Ajax call in json format. So, I will share the data(please find the screenshot) and javascript code.
The fnInitTree function is called on load.
function fnInitTree() {
$("#treeFilterContainer").html("");
userTree = new dhtmlXTreeObject("treeFilterContainer", "100%", "100%", 0);
userTree.setSkin('dhx_skyblue');
userTree.setImagePath("../Scripts/tree/imgs/csh_bluebooks/");
userTree.attachEvent("onclick", function (id, text) {
PreviewLogFile(id);
});
}
and this is the callback function from Ajax POST.
var callBack = function fnSaveSuccess(msg) {
if (msg.success == true) {
$("#treeFilterContainer").css('display', 'block');
var result = msg.TreeData;
userTree.deleteChildItems(0);
userTree.loadJSONObject(result);
}
}