|
Can someone please help me to understand how to configure or
code a column sort for a Tomahawk datatable? Specifically, I’m not
clear on how or what sort method is called? Do the Tomahawk components
take care of the sort for me, or do I need to code the sort myself (and if so
where)? I think I have the JSP coded correctly: <t:dataTable id="data" styleClass="scrollerTable" var="providers"
value="#{searchproviders_bean.arrlist_providers}" preserveDataModel="false" rows="20" sortColumn="#{searchproviders_bean.sortcolumn}" sortAscending="#{searchproviders_bean.sortascending}" preserveSort="true">
<h:column> <f:facet name="header">
<t:commandSortHeader columnName="id" arrow="true" immediate="false">
h:outputText value="#{messages['sort_id']}" />
</t:commandSortHeader> </f:facet> <h:outputText value="#{providers.id}" /> </h:column> <h:column> <f:facet name="header">
<t:commandSortHeader columnName="category" arrow="true" immediate="false">
<h:outputText value="#{messages['sort_category']}" />
</t:commandSortHeader> </f:facet> <h:outputText value="#{providers.category}" /> </h:column> </t:dataTable> ‘searchproviders_bean’ is the backing
bean, and ‘arrlist_providers’ is an ArrayList. The ArrayList
is initially sorted when it is retrieved from the database. After the
data is retrieved, I disconnect from the database. The data in the
ArrayList will be read-only (will contain search results list – the data
is not updateable.) When the data is displayed to the user, I want
them to be able to sort the data by clicking on the column headings. I have also added the ‘sortcolumn’ and
‘sortascending’ properties to the backing bean as strings with the
appropriate getter/setter methods: public class searchproviders_bean { private ArrayList arrlist_providers; private String sortcol; private String sortascending; ….. The part where I am confused is how to implement the sort
method. I know that the ArrayList gets ‘wrapped’ by a
DataModel object (though I only understand this at a high-level), but I’m
not sure how to configure or code the sort? Does the Tomahawk DataModel
implement the sort or do I need to code the sort? If I need to code the
sort, can someone please help me to understand where to implement this method
and provide any helpful code examples? BTW, currently, the datatable is displaying, but when I
click on the column headings, the data does not sort (but the arrows on the
column header change directions.) Also, I do have a datascroller
connected to the datatable that is working correctly: Thanks Tom |
- Tomahawk DataTable Sort Question - where/how is Sort Code... Tom Butler
- Re: Tomahawk DataTable Sort Question - where/how is ... Thomas Spiegl
- Re: Tomahawk DataTable Sort Question - where/how... Sébastien Marin
- Re: Tomahawk DataTable Sort Question - where... Thomas Spiegl
