flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Konovalov <oleg...@gmail.com>
Subject Rendering Spark Datagroup
Date Thu, 13 Feb 2014 04:36:26 GMT
Hi,




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.dbColEntryVisible}"

   includeInLayout="{hostComponent.dbColEntryVisible}"

   width="100%">



      <s:DataGroup id="dbColDG"

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



itemRenderer="ColumnMapRenderer"



rendererAdd="dbColDG_rendererAddHandler(event)"



rendererRemove="dbColDG_rendererRemoveHandler(event)">

    <s:layout>

        <s:VerticalLayout/>

    </s:layout>

  </s:DataGroup>

</s:FormItem>






[Bindable]

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

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



[Bindable]

public var fieldColumnMapDS:Array = new Array; // includes fieldColumnMaps
among many other structures (e.g. dbFields array).  passes to DataGroup
dataProvider.









// from that ColumnMapRenderer:



<s:HGroup verticalAlign="middle">

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

 <s:DataGroup id="dbField_DataGroup"

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


itemRenderer="ieddata.metaweb.view.renderer.DBFieldFieldColumnMapRenderer"


rendererAdd="dbFieldFCM_DataGroup_rendererAddHandler(event)"


rendererRemove="dbFieldFCM_DataGroup_rendererRemoveHandler(event)">

            <s:layout>

                 <s:VerticalLayout/>

            </s:layout>

  </s:DataGroup>

 </s:HGroup>







override public function set data(value:Object):void {

// Not called explicitly by anything. HOW does it work?

 if (value is dbFields) {

         dbFields = value as dbFields;

                       } else {

         dbFields = 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:

[Bindable]

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



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



Please advise!






TIA,

Oleg.

P.S.: this is alternative for me to doing similar development in FX
DataGrid (see another thread here about a week ago)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message