3.0 beta 2

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
October 19,

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
October 20,
oh forgot to say that is for version 1 not sure if it would work in version 2
J
October 20,
And if you want to refresh only the column-header cell this could help:
oContactsGrid.getTemplate("top/item", i).refresh();
Carlos
October 20,
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
October 20,
I did take that from my server side sorting code :)
J
October 21,
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
November 17,
*bump*
Jason Johnson
November 21,
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)
November 21,
Hello,

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

Nick
July 25,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.