Hi,
When i use the attached script i got the change for all other statment.
i want to display the cell color for each country.
i have attached the code.
hope to get help in that.
thanks
****************** DataGrid2.mxml **********************
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" verticalGap="20" backgroundColor="#7BB5BF" pageTitle="Phone Book Report">
<mx:Model id="PhoneBook" source="C:\Inetpub\wwwroot\PhoneBook\PhoneBook.XML"/>
<mx:Script>
public var aDP:Array = [ {fname:0, cocode:0}, {mname1:1, cicode:1}, {mname1:2, number:2}, {Lname:3}];
private function NameCombine(oItem:Object):String
{
return oItem.fname + " " + oItem.mname1 + " " + oItem.mname2 + " " + oItem.Lname;
}//NameCombine
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" verticalGap="20" backgroundColor="#7BB5BF" pageTitle="Phone Book Report">
<mx:Model id="PhoneBook" source="C:\Inetpub\wwwroot\PhoneBook\PhoneBook.XML"/>
<mx:Script>
public var aDP:Array = [ {fname:0, cocode:0}, {mname1:1, cicode:1}, {mname1:2, number:2}, {Lname:3}];
private function NameCombine(oItem:Object):String
{
return oItem.fname + " " + oItem.mname1 + " " + oItem.mname2 + " " + oItem.Lname;
}//NameCombine
private function NoCombine(oItem:Object):String
{
return oItem.cocode + "-" + oItem.cicode + "-" + oItem.number;
}//NoCombine
</mx:Script>
<mx:DataGrid id="dg" dataProvider="{PhoneBook.Details}" height="90%" vGridLineColor="#999900" headerColor="#993333" rollOverColor="#FFCC99">
<mx:columns>
<mx:Array id="arr">
<mx:DataGridColumn labelFunction="NameCombine" headerText="Name" width="150"/>
<mx:DataGridColumn columnName="country" headerText="Country" cellRenderer="SimpleCustomCellRenderer"/>
<mx:DataGridColumn columnName="city" headerText="City" />
<mx:DataGridColumn labelFunction="NoCombine" headerText="Phone Number" width="100"/>
<mx:DataGridColumn columnName="date" headerText="Date" />
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:Application>
{
return oItem.cocode + "-" + oItem.cicode + "-" + oItem.number;
}//NoCombine
</mx:Script>
<mx:DataGrid id="dg" dataProvider="{PhoneBook.Details}" height="90%" vGridLineColor="#999900" headerColor="#993333" rollOverColor="#FFCC99">
<mx:columns>
<mx:Array id="arr">
<mx:DataGridColumn labelFunction="NameCombine" headerText="Name" width="150"/>
<mx:DataGridColumn columnName="country" headerText="Country" cellRenderer="SimpleCustomCellRenderer"/>
<mx:DataGridColumn columnName="city" headerText="City" />
<mx:DataGridColumn labelFunction="NoCombine" headerText="Phone Number" width="100"/>
<mx:DataGridColumn columnName="date" headerText="Date" />
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:Application>
********************************************************
**************** SimpleCustomCellRenderer.mxml *******************
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" verticalGap="20" backgroundColor="#7BB5BF" pageTitle="Phone Book Report">
<mx:Model id="PhoneBook" source="C:\Inetpub\wwwroot\PhoneBook\PhoneBook.XML"/>
<mx:Script>
public var aDP:Array = [ {fname:0, cocode:0}, {mname1:1, cicode:1}, {mname1:2, number:2}, {Lname:3}];
private function NameCombine(oItem:Object):String
{
return oItem.fname + " " + oItem.mname1 + " " + oItem.mname2 + " " + oItem.Lname;
}//NameCombine
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" verticalGap="20" backgroundColor="#7BB5BF" pageTitle="Phone Book Report">
<mx:Model id="PhoneBook" source="C:\Inetpub\wwwroot\PhoneBook\PhoneBook.XML"/>
<mx:Script>
public var aDP:Array = [ {fname:0, cocode:0}, {mname1:1, cicode:1}, {mname1:2, number:2}, {Lname:3}];
private function NameCombine(oItem:Object):String
{
return oItem.fname + " " + oItem.mname1 + " " + oItem.mname2 + " " + oItem.Lname;
}//NameCombine
private function NoCombine(oItem:Object):String
{
return oItem.cocode + "-" + oItem.cicode + "-" + oItem.number;
}//NoCombine
</mx:Script>
<mx:DataGrid id="dg" dataProvider="{PhoneBook.Details}" height="90%" vGridLineColor="#999900" headerColor="#993333" rollOverColor="#FFCC99">
<mx:columns>
<mx:Array id="arr">
<mx:DataGridColumn labelFunction="NameCombine" headerText="Name" width="150"/>
<mx:DataGridColumn columnName="country" headerText="Country" cellRenderer="SimpleCustomCellRenderer"/>
<mx:DataGridColumn columnName="city" headerText="City" />
<mx:DataGridColumn labelFunction="NoCombine" headerText="Phone Number" width="100"/>
<mx:DataGridColumn columnName="date" headerText="Date" />
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:Application>
{
return oItem.cocode + "-" + oItem.cicode + "-" + oItem.number;
}//NoCombine
</mx:Script>
<mx:DataGrid id="dg" dataProvider="{PhoneBook.Details}" height="90%" vGridLineColor="#999900" headerColor="#993333" rollOverColor="#FFCC99">
<mx:columns>
<mx:Array id="arr">
<mx:DataGridColumn labelFunction="NameCombine" headerText="Name" width="150"/>
<mx:DataGridColumn columnName="country" headerText="Country" cellRenderer="SimpleCustomCellRenderer"/>
<mx:DataGridColumn columnName="city" headerText="City" />
<mx:DataGridColumn labelFunction="NoCombine" headerText="Phone Number" width="100"/>
<mx:DataGridColumn columnName="date" headerText="Date" />
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:Application>
********************************
******************* PhoneBook.XML **********************
<?xml
version="1.0"?>
<PhoneBook><Details><fname>Alaa</fname><mname1>a</mname1><mname2>a</mname2><Lname>T</Lname><country>Jordan</country><city>Amman</city><cocode>962</cocode><cicode>79</cicode><number>999999</number><date>23.Aug.2005</date></Details><Details><fname>Alaa</fname><mname1>a</mname1><mname2>a</mname2><Lname>T</Lname><country>Jordan</country><city>Amman</city><cocode>962</cocode><cicode>79</cicode><number>999999</number><date>31.Aug.2005</date></Details><Details><fname>Suha</fname><mname1></mname1><mname2></mname2><Lname>S</Lname><country>Jordan</country><city>Amman</city><cocode>962</cocode><cicode>79</cico de><number>0000000</number><date>22/08/2005</date></Details><Details><fname>Ahmed</fname><mname1></mname1><mname2>Abdel</mname2><Lname>Aziz</Lname><country>Germany</country><city>Amman</city><cocode>962</cocode><cicode>79</cicode><number>999999</number><date>31/08/2005</date></Details></PhoneBook>
*************************************************************
<PhoneBook><Details><fname>Alaa</fname><mname1>a</mname1><mname2>a</mname2><Lname>T</Lname><country>Jordan</country><city>Amman</city><cocode>962</cocode><cicode>79</cicode><number>999999</number><date>23.Aug.2005</date></Details><Details><fname>Alaa</fname><mname1>a</mname1><mname2>a</mname2><Lname>T</Lname><country>Jordan</country><city>Amman</city><cocode>962</cocode><cicode>79</cicode><number>999999</number><date>31.Aug.2005</date></Details><Details><fname>Suha</fname><mname1></mname1><mname2></mname2><Lname>S</Lname><country>Jordan</country><city>Amman</city><cocode>962</cocode><cicode>79</cico de><number>0000000</number><date>22/08/2005</date></Details><Details><fname>Ahmed</fname><mname1></mname1><mname2>Abdel</mname2><Lname>Aziz</Lname><country>Germany</country><city>Amman</city><cocode>962</cocode><cicode>79</cicode><number>999999</number><date>31/08/2005</date></Details></PhoneBook>
*************************************************************
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
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.