[Image] EchoPoint
Helping you build truly dynamic and stateful web applications!

SortableTable   Click here for complete JavaDoc

The SortableTable component provides a Table that the user can sort by clicking on ones of its columns.  The SortableTable uses a SortableTableModel for sorting the data. 

The SortableTableModel class actually wraps a TableModel object.  The data itself is not sorted but rather a set of shadow indexes are sorted of the underlying table data.  This allows one TableModel to be "sorted" by multiple SortableTable components.

The SortableTableHeaderRender class is used to render the table header cells.  It returns a series of Button objects that can be clicked on to sort the table. 

The look of these buttons is "templated" off the SortableTableHeaderRender object properties, which is itself a Button.





 String[] headerStr = {"Name","Date","Size","Dir"};

TableModel dm = new DefaultTableModel(
new Object[][] {
{"b" ,getDate("98/12/02"),new Integer(14),new Boolean(false)},
{"a" ,getDate("99/01/01"),new Integer(67),new Boolean(false)},
{"d" ,getDate("99/02/11"),new Integer(2) ,new Boolean(false)},
{"c" ,getDate("99/02/27"),new Integer(7) ,new Boolean(false)},
{"foo" ,new Date() ,new Integer(5) ,new Boolean(true)},
{"bar" ,new Date() ,new Integer(10),new Boolean(true)}},
SortableTable table = new SortableTable(dm);

SortableTableHeaderRenderer headerRenderer =
new SortableTableHeaderRenderer((SortableTableModel) table.getModel());

Client Browser Support :

All clients supported by the Echo Framework.


SourceForge Logo

The EchoPoint project is kindly hosted by SourceForge