13 Replies Latest reply on Oct 22, 2010 12:36 AM by sri2520ram

    inheritance in VO and binding in dataGrid (updated)

    sri2520ram

      Hi All,

      I'm new to flex and trying to learn a few concepts..

      I'm new using Flex Builder 3 to develop a simple application that displays a Array collection in data grid....

       

      I have a Value Object called Dept

       

       

      package rxr.issuetracker.vo

      {

      import com.adobe.cairngorm.vo.IValueObject;

       

      [RemoteClass(alias="com.Dept")]

      public class DeptVO implements IValueObject

      {

      public var dept_id:Number;

      public var dept_name:String;

      }

      }

       

       

       

      Another VO is empVO which creates an instance of DeptVO

       

       

      package rxr.issuetracker.vo

      {

      import com.adobe.cairngorm.vo.IValueObject;

       

      [RemoteClass(alias="com.emp")]

      public class empVO implements IValueObject

      {

      public var name:String;

      public var edes:String;

      public var dept_id:Number;

      public var dp:DeptVO;

      }

      }

       

       

       

      I'm trying to implement OOPS in flex...

      I have an ArrayCollection, "arrData" in model class which is bindable...

       

       

      package rxr.issuetracker.model

      {

       

      import com.adobe.cairngorm.model.ModelLocator;

       

      import mx.collections.ArrayCollection;

       

      import rxr.issuetracker.vo.*;

       

      [Bindable]

      public class testModel implements ModelLocator

      {

       

      private static var modelview:testModel;

       

      public static function getInstance():testModel

      {

       

      if(modelview==null)

      {

      modelview=new testModel();

      }

       

      return modelview;

      }

      public function testModel()

      {

       

      if(modelview != null)

      {

      throw new Error("only one instance of model can be created");

      }

      }

      public var arrData:ArrayCollection;

      }

      }

       

      Now i retrieve value from database using spring services as back end..

       

      I store the value in arrData and using Debug i see that the values are stored as follows:

       

      model3.arrData

           [0]-rxr.issuetracker.vo.empVO

      • dept_id
      • edes
      • name
      • dp
        • dept_id
        • dept_name

       

      now i bind this data to dataProvider as follows:

       

       

      <mx:DataGrid id="data" dataProvider="{model3.arrData}">

           <mx:columns>

                <mx:DataGridColumn headerText="Column 1" dataField="edes"/>

                <mx:DataGridColumn headerText="Column 2" dataField="name"/>

                <mx:DataGridColumn headerText="Column 3" dataField="dp.dept_id"/>

           </mx:columns>

      </mx:DataGrid>

       

       

      here in the output, i get values for edes and name

      but dp.dept_id remains blank...

       

      how can i bind this inherited data to dataGrid ??

       

      Message was edited by: sri2520ram