如何禁用拖动ng2-dragula上的某些元素 [英] How to disable drag some element on ng2-dragula
本文介绍了如何禁用拖动ng2-dragula上的某些元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在顶部显示名称组,并取消其上的拖动事件. 如何禁用移动某些元素,例如此组名位于顶部. 我的代码是:
I want to display name group on the top and cancel the drag event on it. How can I disable moving some element like if this group name on the top. My code is:
dragulaService.drag.subscribe((value) => {
console.log(`drag: ${value[0]}`);
});
我的模板:
<div class='wrapper'>
<div class='container' *ngFor='let group of groups' [dragula]='"nested-bag"'>
<div class="center-block">Table Number : {{group.name}}</div>
<div *ngFor='let item of group.items' [innerHtml]='item.name'></div>
</div>
</div>
推荐答案
找到一个解决方案:
dragulaService.setOptions('nested-bag', {
revertOnSpill: true,
moves: function (el:any, container:any, handle:any):any {
debugger
console.log(el, container);
return false;
}
});
这篇关于如何禁用拖动ng2-dragula上的某些元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文