2011-10-17 11 views
0

アイテムレンダラーが使用されていないときに正しくソートされた通常のスパークリストがあります。ただし、次のアイテムレンダラーを使用すると、リストはシャッフルされ、リストの以前のインスタンスのアイテムが表示されます。どんな助けもありがとう。Flex Spark Listコンポーネントアイテムの注文

<?xml version="1.0" encoding="utf-8"?> 
<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" 
       creationComplete="itemRendererInit(event)"> 

<fx:Script> 
    <![CDATA[ 
     import flash.utils.setInterval; 

     import flashx.textLayout.conversion.TextConverter; 

     import mx.events.FlexEvent; 

     protected function itemRendererInit(event:FlexEvent):void { 
      setInterval(resizeItemRenderer, 50); 
      richtext.textFlow= TextConverter.importToFlow(
       '<TextFlow xmlns="http://ns.adobe.com/textLayout/2008"><linkNormalFormat color="#ac0000" textDecoration="none"/><linkHoverFormat color="#ac0000" textDecoration="underline"/><linkActiveFormat color="#ac0000" textDecoration="none"/><p><span fontWeight="bold">' + 
       data[0].toString() + 
       ':</span><br/><br/>' + 
       data[1].toString() + 
       '</p></TextFlow>', TextConverter.TEXT_LAYOUT_FORMAT); 
     } 

     private function resizeItemRenderer():void { 
      richtext.width = parentApplication.width-525; 
     } 
    ]]> 
</fx:Script> 

<s:RichEditableText id="richtext" 
      paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" 
      verticalAlign="middle" editable="false" textAlign="left"/> 

</s:ItemRenderer> 

答えて

0

最終的に、データバインディングの問題であることが判明しました。ありがとう@ M.D。

0

はちょうど私の頭の上に、のcommitPropertiesをオーバーライド代わりのcreationCompleteイベントに頼ってみてください。 creationCompleteでは、単にinvalidatePropertiesを呼び出して、commitProperties()から関数を呼び出してください。

関連する問題