留言板

Drag and Drop support in Textbox List

Jan Tošovský,修改在8 年前。

Drag and Drop support in Textbox List

Liferay Master 帖子: 566 加入日期: 10-7-22 最近的帖子
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,修改在8 年前。

RE: Drag and Drop support in Textbox List

Junior Member 帖子: 94 加入日期: 06-11-27 最近的帖子
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