View Full Version : sortable list

22 Aug 2011, 11:43 PM

I hope I won't offend people by making a comparison : I would like to know if there's the equivalent of "jQuery sortable" function in ExtJS.

I've a list, I would like to be able to drag & drop elements to reorder them.

I first thought of the tree which has a reorder plugin, but, just wanted to know if there's something built in as easy as jQuery implementation or, if there isn't, what would be the easiest way of doing this.

Thank you :D

23 Aug 2011, 12:53 AM
I'm not familiar with the jQuery functionality.

Could you clarify what you mean by a list? Do you mean raw UL/LI markup or do you want an ExtJS component? Any reason for using a tree rather than a grid?

This may be available out-of-the-box with ExtJS too, depends exactly what you want.

23 Aug 2011, 1:03 AM
I finally used a grid instead of a "list" (or even a tree) and I used the gridviewdragdrop plugin.
This is pretty clean client side. It does what I need to.

With jQuery, you can apply a .sortable() method to a <ul></ul> element so that all the children (<li></li>) can be ordered (as display block or inline).
What's convenient with this is that you can get the serialized array of all elements, so for a reordering in a database, you just iterate throught all the elements sent by jQuery and update the database depending on their index.

In ExtJS, you get the dropped record (so you can get its internalId), the target record (internalId too) and if it's after or before it. So it's lighter in terms of amount of data sent to the server, but it requires a little bit more code to upgrade the database.

Anyway, I consider this as solved, thanks :D