$(function () { $('#tt').tree({ url: '/IS/Department/JsonTree?companyID=@(Request.QueryString["companyID"])', lines: true, dnd: true, onSelect: function (node) { add(node.id, null); $(this).tree('expand', node.target); //點擊樹節點,展開子級節點 }, onLoadSuccess: function (node, data) { if (selectID > 0) { var root = $(this).tree("find", selectID); $(this).tree("expandTo", root.target); //展開到某個節點 ,注意這里如果用 $("#tt") 則功能無法實現 } }, onDrop: function (targetNode, source, point) { debugger; if ("append" == point) { var targetId = $('#tt').tree('getNode', targetNode).id; $.ajax({ url: "/IS/Department/UpdateParent", data: { targetId: targetId, sourceid: source.id }, success: function () { } }) } } }); $('#ParentDepartment').combotree('setValue', '@Model.ParentDepartmentID'); });
