1 Reply Latest reply on Jun 23, 2008 3:29 AM by |>AoA<|_killa

    data not passed to ItemRenderer

      Because my itemrenderer isnt working properly when scrolling I wanted to use "override public function set data(value:Object):void" to get it to show the proper image. But I found it isnt being called. So i tried a trace on data.removable(i know for sure this value exists) inside my itemrenderer component and apparently data = null.
      I have no idea why it isnt being passed on. Untill now i've just passed on the data from inside the component with the datagrid to a public string inside the component.

        • 1. Re: data not passed to ItemRenderer
          |>AoA<|_killa Level 1
          Fixed this by doing the following:

          Main component with datagrid(code snippet):

          <local:DeleteProject data="{data}"/>

          Component with the itemrenderer in(code snippet):

          private function checkIfRemovable():void
          if (removable) // Check if it's allowed to be deleted
          this.source = Vars.rooturl + "images/delete.gif";
          this.toolTip = "Delete this project";

          this.addEventListener(MouseEvent.MOUSE_OVER, MousePointers.showHand);
          this.addEventListener(MouseEvent.MOUSE_OUT, MousePointers.clearPointers);
          this.addEventListener(MouseEvent.CLICK, askDeleteProject);
          } else { // Isn't allowed to be deleted
          this.source = Vars.rooturl + "images/delete_gray.gif";
          this.toolTip = "Can't be deleted";

          this.removeEventListener(MouseEvent.MOUSE_OVER, MousePointers.showHand);
          this.removeEventListener(MouseEvent.MOUSE_OUT, MousePointers.clearPointers);
          this.removeEventListener(MouseEvent.CLICK, askDeleteProject);

          private function onCreationComp():void

          override public function set data(value:Object):void
          super.data = value;
          pid = value.ID;
          removable = value.Removable;