:: Forum >>

Override Sort but Use Asc/Desc images

Hey Alex,

Just wondering if you could point me to the best solution that you would reccomend with your api to do this. I can hack into it to do it fine, but I'd rather hear what you have to say about it. I'd like to override the sort, but still see the Ascending and Descending imgs in the header. Is there a way to return false to your method or such that the client side sort doesn't happen but the images switch? Also can I return the current built in index variable to tell me which way its going..

Any input is appreciated,
Thanks man,
Tuesday, January 27, 2004
To change the order of the grid rows (sort?) you need to retrieve the row/values array, re-arrange them and assign back. The properties sort/index and sort/direction control the appearance of the sort indicator in the headers. If you wand to override the default sort - just assign your own handler to the "columnSort" action:

// define custom sort
var mySort = function(src){

// get column index
var i = src.getProperty("item/index");

// get array of row indices
var rows = this.getProperty("row/values");

// re-arrange rows

// assign new rows array
this.setProperty("row/values", rows);

// store column index
this.setProperty("sort/index", i);

// store sort direction
this.setProperty("sort/direction", "ascending");


// assign action handler
obj.setAction("columnSort", mySort);

If you are sorting on the server side - just put data request and sort/index, sort/direction into this method.

Alex (ActiveWidgets)
Wednesday, January 28, 2004
Perfect. I kind of was doing it that way. That was just the answer I was looking for though! Thanks Alex, I appreciate the explanation. This grid is awesome..
Thursday, January 29, 2004
Friday, October 7, 2005
How inlement link on rows
Thursday, January 12, 2006

This topic is archived.

Back to support forum

Forum search