I have this function to that loads data into my tree view. I am using JQTree to do this:
function loadTree() {
$.ajax({
url: "@Url.Action("DisplayChildren", @ViewContext.RouteData.Values["controller"].ToString())",
method: "GET",
success: function (result) {
console.log(result);
$("#tree").empty();
$("#tree").tree({
data: result,
closedIcon: $('<i class="fa fa-folder"></i>'),
openedIcon: $('<i class="fa fa-folder-open"></i>')
});
}
});
}
I call it when I first load the page and also when my modal window closes like this:
$(document).on($.modal.AFTER_CLOSE, function (event, modal) {
loadTree();
$("#modal").empty();
});
The problem now is that when I add an item to the page and I empty and re-call the function, my div is just empty only.
I have tried $('#tree').tree('reload'); as well but nothing happens.