PDA

View Full Version : sort direction style icon on Table



pillindra
27 Jun 2008, 12:20 PM
I would like to show the sort direction style icon on a particular column header when I load the table initially.

I call table.sort(index, sortdir), but that does not display the sort direction style icon in table column header when loaded initially.

I know the sort direction icon (Asc/Desc style icon) shows up when I manually click on the column after the table is initially loaded. Is there anyway, I could show this icon on the initial loading of the screen, so that it is evident to the users to know that the column is sorted by a particular table when initially looked at it.

Thanks,
Padma

gslender
27 Jun 2008, 3:55 PM
You'll need to add this after the table has rendered. I'd agree that a method to set this at construction (ie before render) would be nice - but this works.

The DeferredCommand executes after the UI has been drawn (so you know it will be rendered)



DeferredCommand.addCommand(new Command() {
public void execute() {
mytable.getTableHeader().sort(0, SortDir.ASC);
}
});

pillindra
27 Jun 2008, 4:23 PM
Thank you very much gslender. That worked.

Thanks,
Padma