0 Replies Latest reply on Feb 12, 2014 3:51 PM by olegkon

    Rendering Spark DataGroup

    olegkon Level 1



      I am trying to create Spark custom component which represents a table row

      which includes TextInputs, DropDownList and CheckBox,

      that is to Add/Edit/Delete data (rows) to DB.


      I am pretty new to component development,

      looking at somebody else's code who did something similar (kind of repeater where you can add/delete a row),

      trying to at least bring their similar component on my form,

      and so far failing to show it, even one row.


      Granted, I don't have all data they have, so trying to fake it. Their have structures within structures, within structures (for example, to show list of values in DropDownList's).

      And theire itemRenderer has 6 levels before it gets to standard Spark component (I guess, trying to make code reusable, so break it in layers).

      I would like to at least make it show up on my form and work simplest possible way for now. 


      Have a lot of questions.

      Some exerpts from their code:


      <s:FormItem label="Columns"

                                                                                                          visible="{hostComponent.dbColEntryVisib le}"

                                                                                                          includeInLayout="{hostComponent.dbColEn tryVisible}"



                                                                                      <s:DataGroup id="dbColDG"

        dataProvider="{new ArrayList(hostComponent.fieldColumnMapDS)}"












      public var fieldColumnMaps:Array = new Array;   // how is it passed to the item renderer? 

      and why "new Array", not "new Array()". Is it legitimate?  



                          public var fieldColumnMapDS:Array = new Array; // includes fieldColumnMaps among many other structures.  passes to DataGroup dataProvider.





      // from that ColumnMapRenderer:


      <s:HGroup verticalAlign="middle">

                          <s:Label text="{dsnDBFields.dsn.dsnId}"/>

                          <s:DataGroup id="dbFieldFCM_DataGroup"

                                                         dataProvider="{new ArrayList(dsnDBFields.dbFieldFCMs)}"












      override public function set data(value:Object):void {  // not called explicitly by anything. how does it work?

                                              if (value is DsnDBFields) {

                                                        dsnDBFields = value as DsnDBFields;

                                              } else {

                                                        dsnDBFields = null;


                                              super.data = value;



      Can anyone answer my questions throughout  that code?

      Any code samples?


      So far I managed only to show that  "Add Row" button on my form, and ONLY if I do:


      public var fieldColumnMapDS:Array = [ {name:"anObject"} ];   // have to initialize that array.


      So does DataGroup require to have non-empty arrayprovider to show anything?


      Please advise!