Hi all,
I am using SortableListView. I can drag and drop and reorder the
items in the list, but I cannot see any ajax message going around. I think I
am missing something as newbie.
SortableListView sortableFirst=crearSortableList("firstlist",
"firstlist_firstlist", listData, "imagenDePerfil", "nombre");
add(sortableFirst);
....
....
private SortableListView crearSortableList(String itemList, String item,
List<Jugador> jugadores, final String idImagen, final String idLink){
return new SortableListView(itemList, item, jugadores) {
private static final long serialVersionUID =
1592206924207801984L;
@Override
public void populateItemInternal(final ListItem item) {
final Jugador jugador= (Jugador) item.getModelObject();
RecursosWeb.establecerPerfil2(item, jugador,idImagen,
idLink);
}
};
}
Besides, I added this markup to have the chance to reorder in the list and
with another one, like in this scriptaculous example,
http://wiki.script.aculo.us/scriptaculous/page/print/SortableListsDemo.
I think this already exists but I cant find it, (of course this class is a
mess, I am just testing)
public class MultipleSortableListView extends WebMarkupContainer {
private static final long serialVersionUID = -61199328092575258L;
private SortableListView sortable1;
private SortableListView sortable2;
public MultipleSortableListView(String id, SortableListView sortable1,
SortableListView sortable2) {
super(id);
setSortable1(sortable1);
setSortable2(sortable2);
}
public MultipleSortableListView(String id, String string2,String
string3, List<String> listData, String string4,String string5, List<String>
listData2) {
super(id);
//TODO
}
protected void onRender(MarkupStream markupStream)
{
super.onRender(markupStream);
JavascriptBuilder builder = new JavascriptBuilder();
builder.addLine("Sortable.create('" + getSortable1().getMarkupId() +
"',{dropOnEmpty:true,containment:['" + getSortable1().getMarkupId() + "','"
+ getSortable2().getMarkupId() + "'],constraint:false});");
builder.addLine("Sortable.create('" + getSortable2().getMarkupId() +
"',{dropOnEmpty:true,handle:'handle',containment:['" +
getSortable1().getMarkupId() + "','" + getSortable2().getMarkupId() +
"'],constraint:false});");
getResponse().write(builder.buildScriptTagString());
}
public SortableListView getSortable1() {
return sortable1;
}
public void setSortable1(SortableListView sortable1) {
this.sortable1 = sortable1;
}
public SortableListView getSortable2() {
return sortable2;
}
public void setSortable2(SortableListView sortable2) {
this.sortable2 = sortable2;
}
}
But I got a bug because when one of the list is empty, I can't fill it with
an item anymore.