How can I specify the sorting of a datatable with gvNIX datatables? And example based on the Petclinic sample would be great.
For my application I want for each table specify the sorting order of the records in the datatables.
Lock at options supported in src/main/webapp/WEB-INF/tags/datatables/column.tagx
the attributes sortInit
and sortDirection
should help you.
<jsp:directive.attribute name="sortInit"
type="java.lang.String" required="false" rtexprvalue="true"
description="(asc|desc) If sortable is enabled, set the default sorting direction (Default : asc)" />
<jsp:directive.attribute name="sortDirection"
type="java.lang.String" required="false" rtexprvalue="true"
description="((asc|desc)[,(asc|desc)[...]])If sortable is enabled, allow to control the sorting direction(s) (default 'asc,desc') (related to asSorting js-datatables columnDef)" />
By example, on list.jspx:
<table:table data="${pets}" id="l_com_springsource_petclinic_domain_Pet" path="/pets" z="gvs425syhOX//lJjxIylimFQflM=">
<table:column id="c_com_springsource_petclinic_domain_Pet_sendReminders"
property="sendReminders" z="9OZRH4z6dmoKcOlx/Gs0++zdd/A="/>
<table:column id="c_com_springsource_petclinic_domain_Pet_name"
property="name" sortInit="asc" z="USER-MANAGED"/>
<table:column id="c_com_springsource_petclinic_domain_Pet_weight" property="weight" z="sDq86anRDnXzji8d7j+tb9X7coI="/>
....
....
</table:table>
I advise you to review all .tagx files. Its parameters will show you all supported options and features you can use.
Good luck!