0 Replies Latest reply on Mar 16, 2011 10:41 AM by Henrique Zambon

    Flex 4 List - issues with drag and drop

    Henrique Zambon

      I have two different Spark List elements, with two different ItemRenderers, one of them with dragEnabled="true" and the other with dropEnabled="true", in such a way that whenever I drag from one and drop in the other, a copy of the object dropped is created and inserted in the second List's dataProvider.

       

          <s:List id="source"
                  itemRenderer="componentsRenderers.SourceItemRenderer"
                  dragEnabled="true"
                  dataProvider="{elements}"/>
      
          <s:List id="destination"
                  itemRenderer="componentsRenderers.DestinationItemRenderer"
                  dragEnabled="false"
                  dropEnabled="true"
                  change="destinationChanged(event)"/>
      

       

      The event handler destinationChanged() is a method that parses the recently added object, removes it, and creates a new one that, among other stuff, has an UIComponent that has to be rendered.

       

      The hole thing works well, except by one thing: as soon as the I load the application, the UIComponent of the first item to be dropped in destination never gets renderer. The full object is there and all the other functionalities related to it work, but the component doesn't get rendered. If I delete the object, making the List empty again, and insert it again, it gets rendered!

       

      Also, after inserting the 'invisible' one, all the following inserts works, even if I remove all elements and start inserting again.

      Also, the itemRenderer `DestinationItemRenderer` gets rendered twice for the first element to be dropped.

       

      Ideas?

      Thanks!