3.2.0

Making an associative array for columns and row values

Hi, first of all, this grid is wonderful and i can see that a lot of hard work has been put into it.
I've been looking at the grid for just a day now, and i'm wondering if the indices of the columns/ rows can be replaced with a custom key.
Presently the columns are stored with numerical indices i,e, 0,1,2..etc.
[1=co11,2=col2,3=col3...]
Is there a way for me to replace these indices with a custom value, so i can have something like this..
[key1=col1,key2=col2....etc]
If this possible, i then should be able to get a column value like this -
var value = obj.getColumnText( index);, where index is say "key1".
Thanks.


D
June 16,
I did stumble upon another message in the forum where u basically explained how to replace the default row/column array index numbers with custom keys i.e. for columns
obj.setColumnValues(valueArray);
Immediately after this i set the column text by passing another array, like this -
obj.setColumnTexts(textArray);
and then set a XML table as a data model to the grid object..
obj.setModel("data", table);
I have valid XML, but when i include the
obj.setColumnValues(valueArray); , the indices change to the key array i provide alright, but the text does't get set. All column headers show as 'undefined' and the grid doesn't get populated.
The moment i remove 'obj.setColumnValues(valueArray);'. The data is rendered fine and the column text shows up.
Can u please tell me what i'm doing wrong?


D
June 17,
Also, debugging the included grid.js (in the runtime folder) is proving to be a little hard for me.
I see that the source code is separated in different folders. Do i just copy in all the js files as is (in separate folders and all), into my war file for it towork ? :(
D
June 17,
When you set column text you should use the same custom keys, not 0,1,2... indexes anymore. Either you set them as associative array or you provide a function which returns text when given a key as an argument.

If you want to use source files instead of runtime you have to copy all subfolders.
Alex (ActiveWidgets)
June 17,
Thanks for the quick response Alex.
D.
June 18,

This topic is archived.

See also:


Back to support forum