IvyApp / ivy-sortable

Ember helper for interacting with jQuery UI's Sortable module.
http://ivyapp.github.io/ivy-sortable/
MIT License
10 stars 6 forks source link

Dynamically changing content removes 'ui-sortable-handle' class from children #2

Closed knownasilya closed 9 years ago

knownasilya commented 9 years ago

So if I have a computed property that changes the content that is passed to {{ivy-sortable}}, the ui breaks because the .ui-sortable-handle class is removed from the li elements.

omghax commented 9 years ago

This is actually a bit of a tricky problem. I'll need to watch the content array and call this.$().sortable('refresh') whenever the content is replaced or mutated. Unfortunately I can't just hook into Ember.CollectionView's arrayDidChange hook either, since I only want to call this after the element has been inserted into the DOM.

omghax commented 9 years ago

I tested this out locally and everything seemed to still work okay, all that happens is you lose the ui-sortable-handle class. That being said, there's a fair amount of code inside that jQuery UI refresh method, so not calling it at all seems like it may cause problems in the long run.

I'll try to get a fix for this in soon. Until then, you can work around the issue by adding itemClassNames="ui-sortable-handle" wherever you call ivy-sortable in your templates.

omghax commented 9 years ago

Thanks for the issue. This is resolved in the 1.0.0-beta.1 release.