jQuery UI Sortable inside a Polymer Element Problems?

531 views
Skip to first unread message

Luke Pacholski

unread,
Feb 26, 2014, 6:09:05 PM2/26/14
to polym...@googlegroups.com
Calling jQuery UI's .sortable() on an element inside the polymer element template was not working correctly for me. The 'helper' element was always out of place.

The only way I've found to make it behave correctly is to either:
1) Dynamically add the "sortable" element and then call sortable() on it.
2) Remove the sortable element form the template DOM, inject it back and *then* call sortable() on it.

Anybody else run into this and have another, better solution?

Scott Miles

unread,
Feb 26, 2014, 6:12:33 PM2/26/14
to Luke Pacholski, polymer-dev
I realize this isn't super helpful right now, but it's important to restate that old-school tools like JQuery are not aware of our new scoping mechanisms and treat the DOM as one gigantic pile of everything.

This means that you cannot rely on these libraries in general to `just work`.


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/4ee8e491-d902-4ccc-9889-48a3fd48a258%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Tomek W

unread,
Feb 27, 2014, 5:20:31 AM2/27/14
to polym...@googlegroups.com
Luke, if you need a sortable feature in Polymer you can take a look at my custom element https://github.com/tomalec/sortable-flexbox-list/ . It does not use jQuery at all and should be pretty lightweight, as it does not change DOM structure, and use CSS flexbox instead.

It is in very early stage, and any comments are very welcome, but basic functionality is there, so I hope you can find something usefull there.

Cheers,
Tomek

Reply all
Reply to author
Forward
0 new messages