In this post we are going to implement the orderable columns for search container.
Following are the steps -
1. Put the following code in your jsp which is used to render the search container.
This If condition is provided to handle the default case. Here defaultColumn and defaultOrder can be replaced with the desired column and order respectively. Here we are sorting the results on the title column.
2. Here is the TitleComparator.java code -
Following are the steps -
1. Put the following code in your jsp which is used to render the search container.
This If condition is provided to handle the default case. Here defaultColumn and defaultOrder can be replaced with the desired column and order respectively. Here we are sorting the results on the title column.
2. Here is the TitleComparator.java code -
3. add the following code to your controller's render method :
4. Here is the search container part -
Now Title column in the search container will be rendered as clickable and upon clicking will sort the title column data.