Skip navigation
Currently Being Moderated

Rendering Spark DataGroup

Feb 12, 2014 3:51 PM

Tags: #spark #datagroup #itemrender #flex_4.5.1

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="{hostCompo nent.dbColEntryVisible}"

                                                                                                    includeInLayout="{h ostComponent.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.  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)}"

                                                   itemRenderer="ieddata.metaweb.view.renderer.DBFieldFieldColumnMapRend erer"

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

[Bindable]

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!

 

 

TIA,

Oleg.

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points