I'd go with nested repeaters.
If you have more than 5-10 items, consider not using scrollbars but
limiting the number of repeater rows, setting recycleChildren="true",
and implements a "page" based navigation (|<, <, >, >|)
Use a custom component to be repeated. Here are some snippets.
Tracy
When working with Repeater, I advise creating a custom component that
you will repeat, and pass it the entire "currentItem", In the component,
implement a "setter" function to receive the currentItem data.
Now, in the component, you can code normally, binding to the data as you
wish, without the hard to read currentItem references. You also avoid
the binding warnings without the cast/conversion because the binding
source is a true XML object.
And, you can dispatch events normally. In the event handler, you can
reference the component via the event.target property, and thus get a
direct reference to the dataProvider item. This is easier to write and
read than having to use getRepeaterItem().
Here are some code snippets:
In the main app or component (note how "clean" and readable this is):
<mx:Application
<mx:VBox ...>
<mx:Repeater id="rp" dataProvider="{_xmlData}" ...>
<mycomp:MyRepeatedComponent xmlItem="{rp.currentItem}" .../>
</mx:Repeater
</mx:VBox>
And in the component, MyRepeatedComponent.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox ...
<mx:Script><![CDATA[
[Bindable]private var _xmlItem:XML;
public function set xmlData(xml:XML):void
{
_xmlItem = xml;
//do any special, non-bound ui stuff you want
}//
]]></mx:Script>
<!-- Now declare the Item UI -->
<mx:Text id="lbDescription" text="[EMAIL PROTECTED]"
width="100%" height="100%" />
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul Steven
Sent: Tuesday, August 28, 2007 3:24 AM
To: [email protected]
Subject: [flexcoders] Display item renderer in only some rows of a
datagrid
Thanks for the reply Tracy
You suggest finding a different solution. I have included a screenshot
here http://www.mediakitchen.co.uk/mark_sheet.jpg
<http://www.mediakitchen.co.uk/mark_sheet.jpg> to illustrate what I am
trying to achieve.
Can you or anyone suggest what sort of component is best suited to
represent this data structure?
Thanks
Paul
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: 24 August 2007 12:04
To: [email protected]
Subject: [SPAM] RE: [flexcoders] Display item renderer in only some rows
of a datagrid
You are attempting something the datagrid is not designed for.
Renderers are column based and will apply to every row. You could
probably make the renderer show a combobox in every 5 the row using a
collection as the dataProvider, being sure to implement
IdropInListItemRenderer to have access to listData, and using
getItemIndex() with the modulus operator.
But then you have the data issue. An interactive renderer should update
the dataProvider item property, and should set its state based on that
property, in the set data() method. How that would work with a combobox
in every 5th row I can't imagine.
You might be able to use some data structure that is external to the
datagrid to support this.
It is an interesting problem, but I'd consider trying to find a
different solution.
Tracy
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul Steven
Sent: Friday, August 24, 2007 2:59 AM
To: [email protected]
Subject: [flexcoders] Display item renderer in only some rows of a
datagrid
I need to display a combobox item renderer in my datagrid only in the
first of every 5 rows. With the remaining 4 rows in this particular
column empty. Then the pattern will repeat again.
This is how I am currently creating the columns however with this
approach the combobox itemrenderer is appearing in all rows
<mx:columns>
<mx:DataGridColumn headerText="No."
dataField="assCriteriaNum" width="60" />
<mx:DataGridColumn headerText="Assessment Criteria"
dataField="assCriteria" width="210"/>
<mx:DataGridColumn headerText="Mark Range"
dataField="markRange" width="50" />
<mx:DataGridColumn headerText="Mark" dataField="mark"
width="70" >
<mx:itemRenderer>
<mx:Component>
<mx:ComboBox>
<mx:dataProvider>
<mx:ArrayCollection>
<mx:String>0</mx:String>
<mx:String>1</mx:String>
<mx:String>2</mx:String>
<mx:String>3</mx:String>
<mx:String>4</mx:String>
<mx:String>5</mx:String>
<mx:String>6</mx:String>
<mx:String>7</mx:String>
<mx:String>8</mx:String>
<mx:String>9</mx:String>
<mx:String>10</mx:String>
</mx:ArrayCollection>
</mx:dataProvider>
</mx:ComboBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>