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

    Databinding to empty XML nodes

      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: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"/>

      Here is an XML fragment of the data provider
      <address_line_1>123 Main St</address_line_1>