1 Reply Latest reply on Aug 24, 2006 7:35 AM by aBill

    multiple dataproviders failing

    ScooterMX
      I have the following function create a list of items that I need displayed in a datagrid. The error I get is "TypeError: Error #1009: Cannot access a property or method of a null object reference." What am I doing wrong?

      <![CDATA[

      private function initApp():void {
      srcgrid.dataProvider = [
      {Employee:'Sanchez, Jorge', Trade:'Carpenter', Skills:'All'},
      {Employee:'Maxwell, James', Trade:'Concrete', Skills:'All'},
      {Employee:'Jamison, Ken', Trade:'H.Equip', Skills:'All'},
      ];

      destgrid.dataProvider = [
      {Employee:'Sanchez, Jorge', Trade:'Carpenter', Skills:'All'},
      {Employee:'Maxwell, James', Trade:'Concrete', Skills:'All'},
      {Employee:'Jamison, Ken', Trade:'H.Equip', Skills:'All'},
      ];
      }
      ]]>

      Then this datagrid control loads it:

      <mx:VBox label="Accordion Button for Panel 1">
      <mx:DataGrid id="srcgrid" allowMultipleSelection="true" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true">
      <mx:columns>
      <mx:DataGridColumn dataField="Employee"/>
      <mx:DataGridColumn dataField="Trade"/>
      <mx:DataGridColumn dataField="Skills"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:VBox>

      <mx:VBox label="Accordion Button for Panel 2">
      <mx:DataGrid id="destgrid" allowMultipleSelection="true" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true">
      <mx:columns>
      <mx:DataGridColumn dataField="Employee"/>
      <mx:DataGridColumn dataField="Trade"/>
      <mx:DataGridColumn dataField="Skills"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:VBox>

      Any Help please?
        • 1. Re: multiple dataproviders failing
          aBill Level 1
          Hi,

          I think you need mx;Array tag

          <mx:DataGrid id="destgrid" allowMultipleSelection="true" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true">
          <mx:columns>
          <mx:Array>
          <mx:DataGridColumn dataField="Employee"/>
          <mx:DataGridColumn dataField="Trade"/>
          <mx:DataGridColumn dataField="Skills"/>
          </mx:Array>
          </mx:columns>
          </mx:DataGrid>

          thanks!
          William Chan