0 Replies Latest reply on Oct 8, 2009 6:08 AM by Thibaud weinachter

    TileList ItemRenderer strange behaviour after resizing

    Thibaud weinachter Level 1

      Hi,

       

      I have a weird problem with my tileList.

      I have to display severals week an be able to see 1,2 ...8 week. The user start with 2 weeks display. But he can choose to see only one Week.

      So I passe the number of column (columnCount) of the tileList from 14 to 7. Every thing works fine, but when i press an item an moving it (like drag and drop but these are disable in my tileList), nothing happens for one week, but when i'm back to 2 weeks, it's like my dataProvider change....

       

      2weeks.JPG

      Normal state

       

       

      see Attached files (pb to upload).

       

      <code>

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:TileList

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml

      "

      xmlns:components="

       

      main.flex.fr.edfgdf.aris.components.*

      "

      creationComplete="creationCompleteHandler();"

      creationCompleteEffect="

       

      {fade}

      "

      rowCount="

       

      1

      "

      height="

       

      25

      "

      allowMultipleSelection="

       

      true

      "

      columnCount="

       

      {nbSemaines*7}

      "

      width="

       

      {nbSemaines*450}

      "

      direction="

       

      horizontal

      "

      borderStyle="

       

      none

      "

      verticalScrollPolicy="

       

      off

      "

      cacheAsBitmap="

       

      true

      "

      selectionColor="

       

      0xFFFFFF

      "

      dropEnabled="

       

      false

      "

      dragEnabled="

       

      false

      "

      dragMoveEnabled="

       

      false

      "

      allowDragSelection="

       

      false

      "

      useHandCursor="

       

      true

      "

      dataProvider="

       

      {joursArray}

      "

       

       

      >

       

       

      <mx:Fade id="fade" duration="1000"

      />

       

       

      <mx:Script>

      <![CDATA[

       

       

      import

      main.flex.fr.edfgdf.aris.events.PlanningInjectDataEvent;

       

       

       

      import

      mx.effects.Fade;

       

       

      import

      mx.controls.Alert;

       

       

      import

      mx.collections.ArrayCollection;

      [

       

      Bindable

      ]

       

       

      public var

      nbSemaines:uint;

       

      [

       

      Bindable

      ]

       

       

      public var

      index:uint;

       

      [

       

      Bindable

      ]

       

       

      public var joursArray:ArrayCollection=new

      ArrayCollection();

       

       

       

      private function creationCompleteHandler():

      void

      {

       

       

      this.dataProvider=new

      ArrayCollection();

      afficheSemaine(nbSemaines);

       

       

      var event:PlanningInjectDataEvent=new PlanningInjectDataEvent(PlanningInjectDataEvent.ROW_CREATED, true

      );

      event.index=index;

      dispatchEvent(event);

      }

       

       

       

       

      /* private function handleEvents(event:Event):void{

       

      this.dataProvider.refresh();

      invalidateProperties();

      invalidateDisplayList();

      invalidateList();

      invalidateSize();

      validateNow();

      } */

       

       

       

      /**

      *

      * @param nbSemaines

      */

       

       

      public function afficheSemaine(nbSemaines:uint):

      void

      {

       

       

      var

      i:uint=0;

       

       

      var

      weekEnd:uint=0;

       

       

      var

      nbJours:uint=nbSemaines * 7;

       

       

      var dejaRempli:Boolean=false

      ;

       

       

      var length:uint = this

      .joursArray.length;

       

       

       

      if (this

      .joursArray.length > 0)

      {

      dejaRempli =

       

      true

      ;

      }

       

       

       

      while

      (i != nbJours)

      {

      weekEnd+=1;

       

       

      var tmpBox:PlannigActiviteContainer=new

      PlannigActiviteContainer();

       

       

      if

      ((weekEnd == 6) || (weekEnd == 7))

      {

      tmpBox.isWeekend=

       

      true

      ;

       

       

      if

      (weekEnd == 7)

      {

      weekEnd=0;

      }

      }

       

       

      if

      (dejaRempli){

       

       

      if

      (i+length == nbJours){

       

       

      this

      .joursArray.source.length = nbJours;

       

       

      return

      ;

      }

       

       

      this

      .joursArray.addItemAt(tmpBox,i+length);

      }

       

      else

      {

       

       

      this

      .joursArray.addItem(tmpBox);

      }

      i+=1;

      }

       

       

      this.dataProvider=this

      .joursArray;

      invalidateDisplayList();

      validateNow();

      }

      ]]>

       

       

      </mx:Script>

       

       

      <mx:itemRenderer>

       

       

      <mx:Component>

       

       

      <components:PlannigActiviteContainer>

       

       

      <mx:Script>

      <![CDATA[

       

       

      import

      mx.utils.ObjectUtil;

       

       

      import

      mx.utils.ArrayUtil;

       

       

      override public function set data(value:Object):

      void

      {

       

       

       

      super

      .data = value;

       

       

      if(value!=null

      ){

      dataProvider = value.dataProvider;

      isWeekend = value.isWeekend;

      dataChangeHandler();

      }

      }

       

       

       

      protected override function commitProperties():void

      {

      dataProvider = data.dataProvider;

      }

       

      ]]>

       

       

      </mx:Script>

       

       

      </components:PlannigActiviteContainer>

       

       

      </mx:Component>

       

       

      </mx:itemRenderer>

      </code>

       

       

       

       

       

       

       

       

       

       

      If seen that a remove event is dispatch when i simulate drag and drop (but these are set to false)...

      The problem only appears when I resize my tileList, when I stay on 2 weeks everything is ok.

       

      Thank's for your help.

       

       

      //sorry for my english, i'm just a french flex developper....

       

      Message was edited by: tib0we

       

      Message was edited by: tib0we