angular-ui/ui-sortable

getSortableWidgetInstance() element.data returns undefined with jQuery 1.7.2 and jQuery-UI 1.8.19

JeskeJL02 opened this issue · 1 comments

I was having issues using the $scope.sortableOptions.disabled in my controller to toggle the sorting functionality off and on.

It turned out to be an issue with the getSortableWidgetInstance() method.
var data = element.data('ui-sortable'); was returning undefined.

My initial thought is our version of jQuery is out of date (1.7.2) paired with jquery-ui.1.8.19.js, but I have not confirmed this to be the cause. I am working on a legacy application so upgrading jquery is more work than its worth at this juncture.

I was able to get the directive to work correctly by replacing var data = element.data('ui-sortable'); with var data = element.sortable('instance'); and removing the widgetName check in the if statement below.

This probably a really low priority issue due to the work around, but I thought I would just bring it to your attention.

Thanks for posting your findings, they can be proven useful to other devs.
This is a really old version of jQuery-UI!
Even v0.10 of this repo (the oldest as far as I remember as a maintainer) requires jQuery-UI v1.9+, which included the aforementioned breaking change.
At this point I don't think about adding support for such an old version.
Once again thanks for reporting.