| h1. Tables |
| |
| Tables are one from most used elements in management tools to display data. As you know WebConsole is based on [Apache Wicket|http://wicket.apache.org] and we use Wicket's style data tables. |
| |
| h2. Configuring tables |
| |
| There is number of options for DataTables, hovewer in this section we'll conver only these related to columns. |
| |
| h3. Column types |
| |
| Wicket comes with *IColumn* type which is used to draw table columns. By implementing this interface you may put own logic, but why don't use columns provided with framework? |
| |
| Let's see what kind of columns Wicket ship: |
| * *AbstractColumn* is base class for implementing columns, for example: |
| {code:java} |
| public class CountingColumn<T> extends AbstractColumn<T> { |
| private int counter = 1; |
| // constructors are skipped |
| public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) { |
| cellItem.add(new Label(componentId, "" + counter++)); |
| } |
| } |
| {code} |
| This code will create new label inside a cell and assign next number to it. |
| * *PropertyColumn* very usefull to display properties from model, eg. |
| {code:java} |
| new PropertyColumn<T>(Model.of("Display value"), "propertyExp"); |
| {code} |
| This will try to evaluate expression 'propertyExp' to obtain field from given object or value from map. |
| * *OrdinalColumn* is small column which does same thing like example with AbstractColumn above. |