----------
<?xml version="1.0" encoding="utf-8"?>
<mx:Model id="allCompModel" source="comps2.xml"/>
<mx:DataGrid id="allComp" width="240" height="600" dataProvider="{allCompModel.computer}">
<mx:columns>
<mx:Array>
<mx:DataGridColumn headerText="A" width="20" cellRenderer="{imageCellRenderer1}"/>
<mx:DataGridColumn headerText="B" width="20" cellRenderer="{imageCellRenderer2}"/>
<mx:DataGridColumn headerText="Partition Name" columnName="title" width="200"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:Application>
Here is the imageCellRenderer1 (imageCellRenderer2 is identical, except for the image pulled)
----------
<?xml version="1.0" encoding="utf-8"?>
<mx:Script>
var obj1:Object;
function setValue(str:String,item:Object) {
if (item.working=="0") {
obj1=item;
obj1.icon="contentA0.jpg";
visible=true
} else {
obj1=item;
obj1.icon="contentA1.jpg";
visible=true
}
}
</mx:Script>
<mx:Image source="{obj1.icon}" verticalAlign="middle" horizontalAlign="center"/>
</mx:VBox>
----------
When ran, DataGrid "allComp" displays 3 columns. The second and third column look right. However the first column always displays what's in the second column. I swapped the cellRenderer code, and first column NEVER displays its content properly...
Any idea??? :|
TIA!
- ptrisnadi
----- Original Message ----
From: Matt Chotin <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wed Nov 2 20:54:18 2005
Subject: RE: [flexcoders] Seeing double in DataGrid
I guess we’ll need the full example, I don’t see anything jumping out at me.
From:
Sent: Wednesday, November 02, 2005 9:46 AM
To:
Subject: [flexcoders] Seeing double in DataGrid
I
have a couple of columns in a DataGrid that are populated by using 2
different ImageCellRenderers. ImageCellRenderer1 displays either image
A or B, and ImageCellRenderer2 displays either image C or D. However,
when ran the first column always displays what is displayed in the
second column. I tried switching the 2 columns, so that the latter
column appears first, but the left column always adopt whatever is
displayed in the right column.
Any idea what causes this?
The code for ImageCellRenderer is pretty straight forward:
<?xml version="1.0" encoding="utf-8"?>
<mx:Script>
var obj1:Object;
function setValue(str:String,item:Object) {
if (item.prm1=="0") {
obj1=item;
obj1.icon="obj1.jpg";
visible=true
} else {
obj1=item;
obj1.icon="obj2.jpg";
visible=true
}
}
</mx:Script>
<mx:Image source="{obj1.icon}" verticalAlign="middle" horizontalAlign="center"/>
</mx:VBox>
TIA,
- ptrisnadi
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

