I'm adding an item and then wanting to refresh the TreeView. It works every other time. The node is always added, but the treeview is refreshed to display it only after I click to add another node. At that time, both new nodes show up. I'm guessing that the first ajax call hasn't completed when the treeview.dataSource.read() statement is reached. Is there a way to execute a "wait" until the AddNode statement has completed?
Here's my javascript:
// Add Node$("#createCategory").click(function () { var name = $("#newCategory").val(); if (name != "") { $.ajax({ url: '@Url.Action("AddNode","Categories")', type: "POST", data: { CategoryName: name } }); kendoConsole.log("Adding " + name); //var treeview = $("#treeview").data("kendoTreeView"); treeview.dataSource.read(); } else { kendoConsole.log("Please enter non-empty name"); } $("#newCategory").val("") $("#newCategory").focus()});