0
これは私がAJAX投稿の成功後、剣道ツリービュー(サーバデータバインディングタイプ)を呼び出すにはどうすればよいですか?
Html.Kendo().TreeView()
.Name("TreeViewTemplateBiding")
.Events(events => events
.Select("onSelect"))
.BindTo((IEnumerable<OrgChart.Models.NodeViewModel>)ViewBag.Tree, (Kendo.Mvc.UI.Fluent.NavigationBindingFactory<TreeViewItem> mappings) =>
{
mappings.For<OrgChart.Models.NodeViewModel>(binding => binding.ItemDataBound((item, node) =>
{
item.Id = node.Id;
item.Text = node.Title;
//item.Url = "/Organizational/Chart/" + node.Id;
//item.Expanded = node.Expanded;
})
.Children(node => node.Children));
})
)
をバインドするために使用しているとAjaxのポストがONSELECTノードデータを取得するために使用され、その子を取得するためにコントローラに送信している剣道のツリービューです。
<script>
function onSelect(e) {
alert("hi");
var data = this.text(e.node);
alert(data);
var a = data.split("- ").pop();
alert(a);
$.ajax({
url: '@Url.Action("Chart", "Organizational")',
type: 'Post',
dataType: 'json',
data: { a : a },
async: true,
cache: false,
success: function (data) {
alert("sending");
process(data);
},
error: function (data) { }
});
$(document).ready(function() {
treeview = $("#treeview").data("kendoTreeView");
});
}
</script>
投稿が成功した後、再び剣道の木を呼び出す必要があります。
の後ろあなたはおそらくによっていくつかの時間を節約することができますすべてのノードに一意のIDがある場合は、ここでHierarchicalDataSourceを使用します。 –
TreeViewのHierarchicalDataSourceは、ロードされていなければ、選択されたノードの子を取得するためにエンドポイントへのコールバックを行います。 –
どうすればいいですか?私はこれを手伝ってくれます。 – Bharath