:: Forum >>
v2.0 - Setting default sort on initial render of grid
Hi,
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:
myGrid.setSortColumn(1);
myGrid.setSortDirection("ascending");
myGrid.refresh();
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,
BT
BT
Thursday, November 10, 2005
this.setSortColumn(index);
this.setSortDirection("ascending", index);
Carlos
Thursday, November 10, 2005
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.
BT
Thursday, November 10, 2005
document.write(obj);
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.
Kiwamu
Saturday, April 22, 2006
This topic is archived.
Back to support forum
Forum search