RSS

Sorting numerical values using JSP

02 Mar

HI folks,

Sharing with you all something i have faced recently in my development.

Recently i have faced an issue that digits are not sorting using <display:table> columns in the JSP page.

Issue : In JSP page, using <display:table> tag and <display columns> to display the collection of records in a table format. All columns are populating with data in unsorted order. Here issue is, it is displaying all the records in the table in unsorted way. Need to sort all columns when clicking on the column name right side(clicking on upper arrow or down arrow).

Solution :
1. I have changed the return type of returning varaible from String to Long in java bean
2. I have added sortable=true but it did not worked.
3. I have also added addition property sortProperty=”codeValue” (codeValue is the property which is defined in the struts-config.xml file).

I am all set once i have folled the above steps.

Sample code here:
<display:column property=”codeValue” title=”code” sortProperty=”codeValue” sortable=”true” />

Useful links:

http://en.wikipedia.org/wiki/Help:Sorting
http://www.displaytag.org/1.2/tut_links.html

Happy Learning!.

Get glued to know more updates.

Have a nice day:-)

Advertisements
 
Leave a comment

Posted by on March 2, 2013 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: