Foros de discusión

Drag and Drop support in Textbox List

Jan Tošovský, modificado hace 8 años.

Drag and Drop support in Textbox List

Liferay Master Mensajes: 566 Fecha de incorporación: 22/07/10 Mensajes recientes
Dear All,

is there any possibility to enable reordering items in textbox list? Ideally just by d&d. Currently new items cannot be later moved to desired location without deleting items in between :-(

http://alloyui.com/versions/1.5.x/examples/textboxlist/

Thanks, Jan
thumbnail
Nate Cavanaugh, modificado hace 8 años.

RE: Drag and Drop support in Textbox List

Junior Member Mensajes: 94 Fecha de incorporación: 27/11/06 Mensajes recientes
Hi Jan,
I haven't tried this, but I think it could work.
But basically, the TextboxList has a property called entities on it, which is the DataSet collection that has the items you need.

What I imagine could be done would be on drag start, grab the index of the current token, save that, and then, on drop, again, grab the new index.

Then, using that information, you can modify the underlying entities object by doing something like:

var entry = tbl.entities.item(oldIndex);
tbl.entities.removeAt(oldIndex);
tbl.entities.insert(newIndex, entry);


Again, I haven't tried it, but modifying the entities object will modify the UI, so it'd be worth a shot.

Hopefully that helps emoticon