是否有可能阻止用户拖动Angular UI Tree节点?有一个选项“nodrop”它可以工作,但我也想阻止拖动。
<div ui-tree id="tree-root" data-drop-enabled="false">
<ol ui-tree-nodes ng-model="org.data">
<li ng-repeat="node in org.data" ui-tree-node ng-include="'mnuRenderer.html'"></li>
</ol>
</div>
答案 0 :(得分:1)
您可以使用data-drag-enabled
指令,默认情况下为true。有关更多详细信息,请参阅文档:
https://github.com/angular-ui-tree/angular-ui-tree#data-drag-enabled
<div ui-tree id="tree-root" data-drop-enabled="false" data-drag-enabled="false" >
<ol ui-tree-nodes ng-model="org.data">
<li ng-repeat="node in org.data" ui-tree-node ng-include="'mnuRenderer.html'"></li>
</ol>
</div>
答案 1 :(得分:0)
事实证明它可以被禁用,但仅限于其.js文件的内部
<强>角-UI-tree.js 强>
...
angular.module('ui.tree')
.controller('TreeController', ['$scope', '$element',
function ($scope, $element) {
this.scope = $scope;
$scope.$element = $element;
$scope.$nodesScope = null; // root nodes
$scope.$type = 'uiTree';
$scope.$emptyElm = null;
$scope.$callbacks = null;
$scope.dragEnabled = false;
$scope.emptyPlaceholderEnabled = true;
$scope.maxDepth = 0;
$scope.dragDelay = 0;
$scope.cloneEnabled = false;
$scope.nodropEnabled = false;
...
以下是选项:$scope.dragEnabled
UPD
我发现该选项与data-nodrop
- data-nodrag
一起有一个开关,但它不起作用。