0 Replies Latest reply on Oct 11, 2006 8:10 PM by screamingweasel

    Databinding to empty XML nodes

    screamingweasel
      I ambinding a datagrid to an XML file. When there are no values in a node then I get "[object Object]" displayed rather than an empty string. In the debugger this shows as a Proxy Object. It shows both in the grid and when I try to move the selectedItem value to a textbox for editing. Here is a small sample including XML: Thanks in advance.

      private function ShowAddressDetails():void {
      if (AddressGrid.selectedItem.address_line_1.toString() != null)
      txtAddressLine1.text = AddressGrid.selectedItem.address_line_1;
      if (AddressGrid.selectedItem.address_line_2.toString() != null)
      txtAddressLine2.text = AddressGrid.selectedItem.address_line_2;
      if (AddressGrid.selectedItem.address_line_3.toString() != null)
      txtAddressLine3.text = AddressGrid.selectedItem.address_line_3;
      }

      <mx:Model id="addressModel" source="/data/addresses.xml"/>

      <mx:DataGrid id="AddressGrid" click="ShowAddressDetails();" dataProvider="{addressModel.address}">
      <mx:columns>
      <mx:DataGridColumn headerText="Address 1" dataField="address_line_1"/>
      <mx:DataGridColumn headerText="Address 2" dataField="address_line_2" visible="false"/>
      <mx:DataGridColumn headerText="Address 3" dataField="address_line_3" visible="false"/>
      </mx:columns>
      </mx:DataGrid>


      Here is an XML fragment of the data provider
      <addresses>
      <address>
      <address_id>1</address_id>
      <address_type>PRIM</address_type>
      <address_type_descr>Primary</address_type_descr>
      <address_line_1>123 Main St</address_line_1>
      <address_line_2></address_line_2>
      <address_line_3></address_line_3>
      <city_id>1</city_id>
      <city_name>Irvine</city_name>
      <state_cd>CA</state_cd>
      <zip>92606</zip>
      </address>
      </addresses>