Process XML data in DataTipFunction
I'm using AdvancedDataGrid. My dataTipFunction is defined as:
private function showTip(item:Object):String{
var tempString:String = item.toString;
return tempString;
}
It shows something like this in the tip window:
<product id="10">
<manufacturer>Coke</manufacturer>
<brand>Diet Coke</brand>
<pack>12x12oz-Can</pack>
<invoice>1.00</invoice>
<price>2.00</price>
<quantity>50</quantity>
<type>Soda</type>
<location>A-1</location>
<in_stock_date>2008-11-20</in_stock_date>
<sell_by_date>2009-10-10</sell_by_date>
</product>
I only want to extract one value without tags. I changed the DataTipFunction
to:
private function showTip(item:Object):String{
var tempString:String = item.production.brand;
return tempString;
}
ReferenceError: Error #1069: Property product not found on
mx.controls.advancedDataGridClasses.AdvancedDataGr idColumn and there is no
default value.
at
com.bao.components::SodaShop/showTip()[C:\Users\Jim\flex3workspace\src\com\bao\c
omponents\SodaShop.mxml:18]
at
mx.controls.advancedDataGridClasses::AdvancedDataG ridColumn/itemToDataTip()[C:\w
ork\flex\dmv_automation\projects\datavisualisation \src\mx\controls\advancedDataG
ridClasses\AdvancedDataGridColumn.as:1443]
...
Is there an easy way to parse XML in DataTipFunction?
|