ListSorter demo

Description
This page displays a ListSorter component.
It allows you to sort a list with a drag and drop.

The list has to be nested inside a form and can be submitted with a standard form submit.

Notice : It's up to you to provide the rendering of the elements of the list in the list body (as for a t:loop) .


In Action

Drag and drop these elements, then submit, your list will be sorted on server :

  • John Smith, 34 years old
  • Paul Carter, 58 years old
  • Simon Carpenter, 18 years old
  • Jill Valent, 24 years old



TML Source code

		<t:form>
			<br/>Drag and drop these elements, then submit, your list will be sorted on server :<br/><br/>
			<ex:listSorter source="list" value="element">
				${element.firstName } ${element.lastName }, ${element.age } years old
			</ex:listSorter>
			<t:submit/>
		</t:form>
	



Java code

	public class Example1
	{
	    @Persist
	    @Property
	    private List<User> list;
	
	    @Property
	    private User element;
	
	    void onActivate()
	    {
		    if(list == null){
				list = new ArrayList<User>();
		        list.add(new User(1, "John", "Smith", 34));
		        list.add(new User(1, "Paul", "Carter", 58));
		        list.add(new User(1, "Simon", "Carpenter", 18));
		        list.add(new User(1, "Jill", "Valent", 24));
		    }
	    }
	}