:: Forum >>

Sort Indicator

I have a grid control an I called:

oContactsGrid.sort (3, 'ascending');

When the page loads. The next challenge I have is how do I get the sort indicator to appear to let the user know which column the grid is sorted on? It works fine if I click a header to sort, but not when calling the "sort ()" method.

Thanks!
Jason Johnson
Wednesday, October 19, 2005

oContactsGrid.setSortProperty("index", i);
    oContactsGrid.setSortProperty("direction", d);
    oContactsGrid.refresh();


I think that should work i is column and d is 1 or 0, as I recolect anyway :)

you only need the refresh if you have already displayed the grid
J
Thursday, October 20, 2005
oh forgot to say that is for version 1 not sure if it would work in version 2
J
Thursday, October 20, 2005
And if you want to refresh only the column-header cell this could help:
oContactsGrid.getTemplate("top/item", i).refresh();
Carlos
Thursday, October 20, 2005
Thanks for all your help!

I finally got it working with this code:

oContactsGrid.sort (3, 'ascending');
oContactsGrid.refresh ();


When I used:

oContactsGrid.sort (3, 'ascending');
oContactsGrid.getTemplate ('top/item', 3).refresh ();


The headers refreshed with the correct sort indicator, and the data sorted internally, but the grid data didn't update visually. I could see how using the 'top/item' refresh method would be useful for server-sorted data, however.

BTW, the sort direction must be 'ascending' or 'descending' (strings), not integer 0 or 1 to work.
Jason Johnson
Thursday, October 20, 2005
I did take that from my server side sorting code :)
J
Friday, October 21, 2005
Does anyone know of a way to "fake" the sort indicator, for example when displaying data that is pre-sorted server-side?

I don't want to actually call the grid's sort () method, but I want to manipulate the sort indicator.

Any ideas?
Jason Johnson
Thursday, November 17, 2005
*bump*
Jason Johnson
Monday, November 21, 2005
Jason,

you should set the properties of the sort model

obj.setSortProperty("index", index);
obj.setSortProperty("direction", direction);

and then refresh the grid (or this particular header)
Alex (ActiveWidgets)
Monday, November 21, 2005
Hello,

Is it possible to set different colors to the sort indicator? If so, how can this be accomplished?

Nick
Tuesday, July 25, 2006

This topic is archived.


Back to support forum

Forum search