
$(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');
});