Script.aculo.us SortableListView

Drag/Drop reordering of list items

Documentation on the scriptaculous library can be found here:
http://wiki.script.aculo.us/scriptaculous/show/Sortables

This Wicket extension that integrates the very sweet scriptaculous Sortable Javascript component into Wicket and handles all the work for drag/drop reordering of list items.

The Java code is just slightly different from the ListView. You must pass in a wicketId for the list container (ul, ol, table, etc) as well as the wicketId for the individual list item (li, tr, etc).

add(new SortableListView("itemList", "item", listData) {
  public void populateItemInternal(final ListItem item) {
    MyObject bean = (MyObject) item.getModelObject();
    new Label(item, "label", bean.getLabel());
  }
});

The HTML template is nearly identical to a standard ListView too. You just need to add a wicketId to the parent container.

<ul wicket:id="itemList">
  <li wicket:id="item">
    <span wicket:id="label">Something unique for this object</span>
  </li>
</ul>

original component published by Ryan Sonnek


Browse Space

- Pages
- News
- Labels
- Attachments
- Bookmarks
- Mail
- Advanced
- Activity

Explore Confluence

- Popular Labels
- Notation Guide

Your Account

Log In

or Sign Up  

Other Features

Add Content