rocheking

rocheking
- Name: [not set]
- Favorite Languages: [not set]
- Website: [not set]
- Location: [not set]
- About Me: [not set]
-
Accessing DataGrid ItemRenderers
03/16/2009 - 17:49
Hi I'm getting a lot out of your posts on item renderers. Thanks. I'm hoping there's an easy answer to the following. Sorry for the length!
I have a datagrid. On creation I call a function that loops through some XML data to create my column array.
For each iteration I set the item renderer to use a custom component.
In shorthand it's:
for each child in myXML {
col = new DataGridColumn();
col. etc. to set some properties...
col.itemRenderer = new ClassFactory(myRenderer);
}You can see, I use the same item renderer for each column (called myRenderer).
Here's some simple data. For simplicity, let's pretend that all I want my item renderer to do is output the data as a string.
<row id="row1">
<columnA>A1 </columnA>
<columnB>B1 </columnB>
<columnC>C1 </columnC>
</row>
<row id="row2">
<columnA>A2 </columnA>
<columnB>B2 </columnB>
<columnC>C2 </columnC>
</row>In myRenderer I have something like:
<mx:TextArea id="output" text="{data}">which outputs the whole row1 node repeated in each cell. In row1 it's etc. repeated in columns A B and C.Or I can have:
<mx:TextArea id="output" text="{data.columnA}">which outputs A1 B1 C1 repeated for every cell in row 1 and A2 B2 C2 for every cell in row 2I'm obviously after the syntax that allows me to output the correct text for each column something that might be like -- text="{data[currentColumn]}"
I'm wondering if that's not possible and if not I'm hoping I can do it by including a function on my item renderer that can bridge the gap.
Thanks!
Recent Comments