Type Parameters:
T - The model object type
S - the type of the sorting parameter
All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IFeedbackContributor, IConverterLocator, IMetadataContext<Serializable,Component>, IQueueRegion, IHeaderContributor, IPageable, IPageableItems, IRequestableComponent, IHierarchical<Component>, IClusterable
Direct Known Subclasses:
AjaxFallbackDefaultDataTable, DefaultDataTable

public class DataTable<T,S> extends Panel implements IPageableItems
A data table builds on data grid view to introduce toolbars. Toolbars can be used to display sortable column headers, paging information, filter controls, and other information.

Data table also provides its own markup for an html table so the developer does not need to provide it himself. This makes it very simple to add a datatable to the markup, however, some flexibility.

Example

 <table wicket:id="datatable"></table>
 
And the related Java code: ( the first column will be sortable because its sort property is specified, the second column will not )
 // Application specific POJO to view/edit
 public class MyEntity {
   private String firstName;
   private String lastName;

   // getters and setters
 }

 public class MyEntityProvider implements IDataProvider<MyEntity> {
     ...
 }

 List<IColumn<MyEntity, String>> columns = new ArrayList<>();
 
 columns.add(new PropertyColumn<MyEntity, String>(new Model<String>("First Name"), "firstName", "firstName"));
 columns.add(new PropertyColumn<MyEntity, String>(new Model<String>("Last Name"), "lastName"));
 
 DataTable<MyEntity,String> table = new DataTable<>("datatable", columns, new MyEntityProvider(), 10);
 table.addBottomToolbar(new NavigationToolbar(table));
 table.addTopToolbar(new HeadersToolbar(table, null));
 add(table);
 
Author:
Igor Vaynberg (ivaynberg)
See Also: