Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's the workaround I've ended up using. </p> <p>In it's own way, the <code>DataGroup</code> is dripping Spark's compositional goodness, in that it exposes a <code>rendererUpdateDelegate</code> property, which you can set with your own class to provide whatever custom functionliaty you're after.</p> <p>While it's frustrating that the interface got dropped without really being advertised, this approach is much more powerful.</p> <p>Here's an example class. In my example, I want the last renderer to have it's <code>collapsable</code> property set to <code>false</code>:</p> <pre><code>/** * Decorates another IItemRendererOwner (eg., a DataGroup) and augments the updateRenderer method * to set the isCollapsable property */ public class ThreadMessageRendererUpdateDelegate implements IItemRendererOwner { private var _dataGroup:DataGroup; public function get dataGroup():DataGroup { return _dataGroup; } public function set dataGroup(value:DataGroup):void { _dataGroup = value; if (dataGroup) { dataGroup.rendererUpdateDelegate = this; } } public var dataProvider:ArrayCollection; public function ThreadMessageRendererUpdateDelegate(owner:DataGroup=null) { this.dataGroup = owner; } public function itemToLabel(item:Object):String { return dataGroup.itemToLabel(item); } public function updateRenderer(renderer:IVisualElement, itemIndex:int, data:Object):void { dataGroup.updateRenderer(renderer,itemIndex,data); if (renderer is ThreadMessageRenderer) { ThreadMessageRenderer(renderer).collapsable = itemIndex &lt; dataProvider.length - 1; } } } </code></pre> <p>And here's it's example usage:</p> <pre><code>&lt;fx:Declarations&gt; &lt;viewer:ThreadMessageRendererUpdateDelegate dataProvider="{dataProvider}" dataGroup="{threadList}" /&gt; &lt;/fx:Declarations&gt; &lt;fx:Script&gt; &lt;![CDATA[ [Bindable] public var dataProvider:ArrayCollection ]]&gt; &lt;/fx:Script&gt; &lt;s:DataGroup height="100%" width="100%" dataProvider="{dataProvider}" itemRenderer="ThreadMessageRenderer" id="threadList" &gt; &lt;/s:DataGroup&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload