ng-nestable icon indicating copy to clipboard operation
ng-nestable copied to clipboard

Disabling dragging/sorting.

Open hledo opened this issue 9 years ago • 5 comments

Hi!

How do it disable draggin/sorting? i couldn't find any info on that on the documentation.

hledo avatar Oct 14 '15 19:10 hledo

Hi @meltedscripts

Maybe is too late but, for the entire list do this:

<div ng-nestable ng-model="items" ng-class="{'dd-nodrag': ctrl.noDragValue}"></div>

Cheers

CristianMR avatar Feb 09 '16 18:02 CristianMR

Thanks!

hledo avatar Feb 23 '16 02:02 hledo

@CristianMR Can u please give an example on how you disabled the drag functionality with code

jpmohan1111 avatar Apr 11 '17 12:04 jpmohan1111

@jpmohan1111 I'm sorry, but I have not a lot of spare time at the moment. But, ng-class would add dd-nodrag to the element classes if the value on ctrl.noDragValue is true. With that in mind, I searched inside the jQuery Nestable library and found a solution. Just follow noDragClass, which value is setted with dd-nodrag.

Line here and here

The handling of the drag is canceled because of the 'dd-nodrag' class on the element.

I think that's enough for you to understand why this works, it's not documented, that's all.

CristianMR avatar Apr 13 '17 16:04 CristianMR

hello guys, when I add ng-class="{'dd-nodrag': ctrl.noDragValue}" it still not working for me

YaroslavG avatar Apr 25 '18 14:04 YaroslavG