3.2.0

Sort no working with custom setCellData function

Hello,

Using 2.0.1, Consider the exhibit:
var data = [['a','z','1'],['b','y','2'],['c','x','3']];
var getData = function(col,row){return data[row][col]};

var grid2 = new AW.Grid.Extended;
grid2.setId("grid2");
grid2.setCellData(getData);
grid2.setHeaderText("header");
grid2.setColumnCount(2);
grid2.setRowCount(3);
grid2.refresh();


With this simple code sample, row sorting works by clicking on the headers.
Now, if I replace:
var getData = function(col,row){return data[row][col]};

with:
var getData = function(col,row){return data[row][col+1]};

... sorting is not working anymore! (tested with IE 6 / Firefox 2.0)
How can I have sorting work as expected?

Thanks
Frédéric
December 4,
You should convert the index to Number here -

var getData = function(col,row){return data[row][Number(col)+1]};
Alex (ActiveWidgets)
December 4,
Great, thank you Alex!
Frédéric
December 5,

This topic is archived.

See also:


Back to support forum