a5hik / ng-sortable

AngularJS Library for Drag and Drop, supports Sortable and Draggable. Supports Touch devices.

Home Page:http://a5hik.github.io/ng-sortable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with using is-disabled in some of the items

DumboJet opened this issue · comments

I am using the is-disabled on some of the items of my rendered array and ng-repeat-start/ng-repeat-end:

                        <li data-ng-repeat-start="at in sortedItems track by at.guid"
                            data-as-sortable-item
                            data-is-disabled="true"
                            class="as-sortable-separator"
                            ng-if="at.IsSeparator">
                            <span ng-bind="at.Label"></span>
                        </li>
                        <li data-ng-repeat-end
                            data-as-sortable-item
                            data-is-disabled="at.IsNew"
                            ng-if="!at.IsSeparator">
                            <div data-as-sortable-item-handle class="drag-handle" ng-show="!at.IsNew"></div>
                            <div> ..................</div>
                        </li>

When the orderChanged gets fired, the items are not ordered correctly according to the drop.
It's like the wrong from/to indexes were used during the reorder.

One note: The disabled items are double in width than the non disabled ones.
I don't know if that matters...

Any quick ideas/fixes?

UPDATE:
Today that I test it seems that the order is not affected at all, although orderChanged gets fired!
Maybe I have missed something yesterday.
But what the hack...
Shouldn't it update the order as it does when there are no disabled items?

Also, the event.source.itemScope.modelValue in orderChanged contains the model of the next item, not the one being dragged.

OK.
I have found it - it was my bad:
The ngModel was set to a wrong value.
Sorry.