3.0 beta 2

v2.0 - Setting default sort on initial render of grid

I am trying to render the grid with a column already sorted by default.
I'm testing in IE only (for now).
I've tried, as suggested in the forum, the following:


In V2.0b1 this will show the sort indicator in the column header but will not sort the data in the column. In V2.0b2 this will show the sort indicator for an instant and then revert back to the original column header (without the sort indicator shown).
Is there a new sequence of events for rendering in V2.0b2??

I then tried the following:

myGrid.sort(1, "ascending");

In V2.0b1 this will show the sort indicator in the column header but clears all my data from the grid instead of sorting the column. In V2.0b2 the effect is the same as described earlier i.e. no sorting and sort indicator appears for an instant.

Finally, in both beta1 and beta2 if I allow the grid to load and call
myGrid.sort(1, "ascending");
in the onClick event of a button everything works as expected: Sort indicator is visible and the data is actually sorted.

Alex, do you have a workaround for this issue? Anyone else having this problem or am I doing something stupid?

Also, I'm wondering if correct sorting based on the column type (i.e. number, string, date (any date format)) will be implemented in the final release??

Many thanks,
November 10,
//    set new sort indicator 
    this.setSortDirection("ascending", index); ///<<<<<

November 10,
Thanks Carlos.
Actually my original post had an error in the code :(
The line
myGrid.setSortDirection("ascending"); should have read
myGrid.setSortDirection("ascending", 1);

Have tried this dude. No joy for sorting before grid is rendered!
Cheers though.
November 10,

window.setTimeout("defSort();", 100);

function defSort(){
obj.sort (6, 'descending');
obj.refresh ();

It's not beautiful, but it works on over 2000 rows XML data.
April 22,

This topic is archived.

See also:

Back to support forum


Version 2

Looking for AW 2.6 ?
The old site is here.