1 Reply Latest reply on Nov 20, 2008 8:18 AM by glen08

    Process XML data in DataTipFunction

    glen08 Level 1
      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;
      }

      Received following error:
      ReferenceError: Error #1069: Property product not found on mx.controls.advancedDataGridClasses.AdvancedDataGridColumn and there is no default value.
      at com.bao.components::SodaShop/showTip()[C:\Users\Jim\flex3workspace\src\com\bao\components \SodaShop.mxml:18]
      at mx.controls.advancedDataGridClasses::AdvancedDataGridColumn/itemToDataTip()[C:\work\flex\ dmv_automation\projects\datavisualisation\src\mx\controls\advancedDataGridClasses\Advanced DataGridColumn.as:1443]
      ...

      I also tried HitData type instead of Object, but get Type Coercion error.

      Is there an easy way to parse XML in DataTipFunction?