Forums de discussion

Drag and Drop support in Textbox List

Jan Tošovský, modifié il y a 8 années.

Drag and Drop support in Textbox List

Liferay Master Publications: 565 Date d'inscription: 22/07/10 Publications récentes
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, modifié il y a 8 années.

RE: Drag and Drop support in Textbox List

Junior Member Publications: 94 Date d'inscription: 27/11/06 Publications récentes
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