Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on how to sort tomahawk datatable

 
Abdul Shams
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I'm new to this forum and am stuck in getting tomahawk datatable to sort columns for me.

From searching the web I understood that sortAscending and sortColumn properties should point to properties in the backing bean. For some reason that does not work!!

HELP me I've looked everywhere

My datatable code is :





and my backing bean code is:





Is there something that needs to be written in the methods? help me out here guys
 
Abdul Shams
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help! Anyone!!
 
Darryl Nortje
Ranch Hand
Posts: 140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Abdul,

I've done this in the past, but not with tomahawk dataTable. So perhaps this might not help, but then again, maybe it does.

I used myFaces dataTable. And I just sorted the List on the backing bean. So in the header of the column I have 2 commands (little up and down arrows) that call a sortXXXAscending or sortXXXDescending method on the backing bean. Then this method just uses the Collections.sort method to sort the actual List containing the data.

This worked fine for me, hope it helps for you.

cheers
Darryl
 
Juan Pablo Rostra
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You dont really need to link those properties with your backing bean. Try something like this (replacing capital text with your values):

The real trick is the tag t:commandSortHeader
 
Abdul Shams
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Darryl but I thought I'd use it as a last resort. I'm hoping to get the tomahawk way correct which would save a lot of effort i think.

Juan, Thank you as well for your reply but I can't get it to work! Does it have something to do with that I'm using an ArrayList as my datasource?

Here is my ammended datatable




Funny thing is that the arrows don't seem to appear as well!



Guys any help would be really appreciated..






.
[ October 19, 2008: Message edited by: Abdul Shams ]
 
James Tillman
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WITHIN your backing bean you must have this:

"sortAscending" must be of type boolean with methods:

public boolean isSortAscending() {
return sortAscending;
}

public void setSortAscending(boolean sortAscending) {
this.sortAscending = sortAscending;
}

"sortColumn" must be of type String with methods:
public String getSortColumn() {
return sortColumn;
}

public void setSortColumn(String sortColumn) {
this.sortColumn = sortColumn;
}

With both of those ALONE you will get the default sort which works when you click on the header title. You can test this by places breakpoints on the setter and you will see values getting set.

To do customized sorting you have to do it on the t:column level (I think). Take a look at what t:column has to offer as attributes.

As for me I'm learning this for the very first time right now but so far what I have told you works for me.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic