Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdating view spark.components.List
    primarykey
    data
    text
    <p>I am using a List component inside an itemRenderer. The main user interaction involves dragging an item from the List in one renderer and dropping it in another. </p> <p>My problem: When the data object is updated I want the Lists' height to be modified according to the number of objects in the dataprovider(dp), which is passed to the List from the data object. Now I have tried to invalidate the display of the List, refresh its dp and have tried putting this line <code>assets.length &gt; 0 ? assetList.percentHeight = 100 : assetList.height = 10;</code> in other event handlers, such as dragdrop handlers, collection event handlers for the dp etc. I have also tried refreshing the dp for the List component that is using this renderer. The view does eventually get updated but only if I resize the list, or use the scroller or when I begin dragging a new List item but never after the drop.</p> <pre><code>&lt;s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" autoDrawBackground="true" width="100%" creationComplete="init()" currentState="collapsed"&gt; &lt;fx:Script&gt; &lt;![CDATA[ [Bindable] private var itemRenderer:ClassFactory; [Bindable] private var colWidth:Number = 100; [Bindable] private var assets:ArrayCollection = new ArrayCollection;; public function init():void{ itemRenderer = new ClassFactory(DefaultRenderer); this.addEventListener(FlexEvent.DATA_CHANGE, onDataChange); } private function onDataChange(e:FlexEvent):void { assets = data.assets; trace(data.name, assets.length); assets.length &gt; 0 ? assetList.percentHeight = 100 : assetList.height = 10; } ]]&gt; &lt;/fx:Script&gt; &lt;s:Group width="100%"&gt; &lt;s:layout&gt; &lt;s:VerticalLayout gap="0" /&gt; &lt;/s:layout&gt; &lt;s:ToggleButton id="viewToggle" label="{data.name}" width="100%" height="50" /&gt; &lt;s:List id="assetList" width="100%" dataProvider="{assets}" height = "10" top="0" left="0" bottom="0" right="0" dragEnabled="true" allowMultipleSelection="true" dragMoveEnabled="true" dropEnabled="true" itemRenderer="{itemRenderer}" &gt; &lt;s:layout&gt; &lt;s:TileLayout requestedColumnCount="2" horizontalGap="0" verticalGap="0" columnWidth="{colWidth}" rowHeight="{colWidth}"/&gt; &lt;/s:layout&gt; &lt;/s:List&gt; &lt;/s:Group&gt; &lt;/s:ItemRenderer&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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