3.2.0

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,
Paul
January 27,
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
rows.reverse();

// 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");

this.refresh();
}

// 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)
January 28,
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..
Paul
January 29,
TKS TOO
wtavares
October 7,
How inlement link on rows
rajneesh
January 12,

This topic is archived.

See also:


Back to support forum