拖放 Ignite UI 树视图
Drag and drop Ignite UI tree view
我正在使用 Ignite UI 进行树视图拖放。
有什么办法可以让拖动的项目保留在列表中吗?
一旦项目被放到新位置,它就会从以前的位置删除项目。如何在两个位置都保留物品?
$("#StructureList").igTree({
singleBranchExpand: true,
checkboxMode: 'triState',
dataSource: data,
dataSourceType: 'json',
bindings: {
textKey: 'LineName',
valueKey: 'LineID',
imageUrlKey: 'ImageUrl',
childDataProperty: 'FacDetails',
bindings: {
textKey: 'FacName',
valueKey: 'FacID',
childDataProperty: 'strDetails',
bindings: {
textKey: 'strName',
valueKey: 'strID'
}
}
},
dragAndDrop: true,
dragAndDropSettings: {
allowDrop: true,
dragAndDropMode: "copy",
customDropValidation: function (element) {
// Validates the drop target
var valid = true,
droppableNode = $(this);
if (droppableNode.is('a') && droppableNode.closest('li[data-role=node]').attr('data-value') === 'File') {
valid = false;
}
return valid;
}
}
});
Ignite UI igTree
具有三种不同的拖放模式 - 默认、移动、复制。
默认 - 如果没有按住修改键,则移动删除的节点;如果按住 ctrl,则复制。
move - 删除的节点总是被移动,因此从源中删除。
copy - 删除的节点总是被复制,因此保留在源中。
这是 docs。
为了让它始终复制,将树模式设置为 copy
。
$(".selector").igTree({
dragAndDropSettings : {
dragAndDropMode: "copy"
}
});
我正在使用 Ignite UI 进行树视图拖放。
有什么办法可以让拖动的项目保留在列表中吗?
一旦项目被放到新位置,它就会从以前的位置删除项目。如何在两个位置都保留物品?
$("#StructureList").igTree({
singleBranchExpand: true,
checkboxMode: 'triState',
dataSource: data,
dataSourceType: 'json',
bindings: {
textKey: 'LineName',
valueKey: 'LineID',
imageUrlKey: 'ImageUrl',
childDataProperty: 'FacDetails',
bindings: {
textKey: 'FacName',
valueKey: 'FacID',
childDataProperty: 'strDetails',
bindings: {
textKey: 'strName',
valueKey: 'strID'
}
}
},
dragAndDrop: true,
dragAndDropSettings: {
allowDrop: true,
dragAndDropMode: "copy",
customDropValidation: function (element) {
// Validates the drop target
var valid = true,
droppableNode = $(this);
if (droppableNode.is('a') && droppableNode.closest('li[data-role=node]').attr('data-value') === 'File') {
valid = false;
}
return valid;
}
}
});
Ignite UI igTree
具有三种不同的拖放模式 - 默认、移动、复制。
默认 - 如果没有按住修改键,则移动删除的节点;如果按住 ctrl,则复制。
move - 删除的节点总是被移动,因此从源中删除。
copy - 删除的节点总是被复制,因此保留在源中。
这是 docs。
为了让它始终复制,将树模式设置为 copy
。
$(".selector").igTree({
dragAndDropSettings : {
dragAndDropMode: "copy"
}
});