3.2.0

Trouble filling grid

I have the following array, then when setting the content for the grid
var users = [["http://www.site.com/page1.php"],
        ["http://www.site.com/page2.php"],
        ["http://www.site.com/page3.php"]];

obj.setCellText(function(i, j){return users[i][j]});


I get the first row having the correct first array element, then the next 2 rows are inserted with undefinated.

Any suggestions?
Tony
December 21,
just use

obj.setCellText(users);


it's much easier.
Jim Hunter
December 21,
I guess the problem is with row/column order - in version 2 the first argument is column index (was row in v1), so it should be

obj.setCellText(function(col, row){return users[row][col]});

and, as Jim says, you will get the same result using

obj.setCellText(users);
Alex (ActiveWidgets)
December 21,
Thanks, both suggestions work. Now that I play with the code more I am learning it better. Just taking longs hours, but I know once I get it down, this is going to be the best product ever. Once again thanks Jim and Alex.
Tony
December 21,
Actually I take that back,
using Jim's way

obj.setCellText(users);

Only fills the grid with the first element of the array for all rows.

obj.setCellText(function(col, row){return users[row][col]});

That works properly though.
Tony
December 21,
If setCellText(users) doesn't work properly then it looks like there might be a bug in the system. Alex is going to have to look into passing in an array with only one column as this should work the same as a multi dimensional array.

Glad you have it working though.
Jim Hunter
December 22,

This topic is archived.

See also:


Back to support forum