3 Replies Latest reply on Oct 28, 2008 11:18 AM by Newsgroup_User

    ClassFactory

    iceflex
      hello,
      I need to dynamically change the state of my DataGridColumn's itemRenderer, which is a ComboBox.
      In respond to a click, I need to set selected item to "Accepted". For some reason it setting the correct value only once in 5-10 clicks.
      Here is my code:

      public function onAcceptAll():void{
      var factory:ClassFactory =
      new ClassFactory(com.myname.components.MyComboBox);
      factory.properties = { text: 'Accepted' };
      col.itemRenderer = factory;
      }

      <mx:DataGridColumn headerText="Accept/Reject" textAlign="center" id="col"
      dataField="status"
      itemRenderer="com.myname.components.MyComboBox"/>

      Does anyone know if I have to add anything else, like refresh or invalidate?

      Thanks,
      Michael.
        • 1. Re: ClassFactory
          Level 7

          "iceflex" <webforumsuser@macromedia.com> wrote in message
          news:ge7b83$hpm$1@forums.macromedia.com...
          > hello,
          > I need to dynamically change the state of my DataGridColumn's
          > itemRenderer,
          > which is a ComboBox.
          > In respond to a click, I need to set selected item to "Accepted". For some
          > reason it setting the correct value only once in 5-10 clicks.
          > Here is my code:
          >
          > public function onAcceptAll():void{
          > var factory:ClassFactory =
          > new ClassFactory(com.myname.components.MyComboBox);
          > factory.properties = { text: 'Accepted' };
          > col.itemRenderer = factory;
          > }
          >
          > <mx:DataGridColumn headerText="Accept/Reject" textAlign="center" id="col"
          > dataField="status"
          > itemRenderer="com.myname.components.MyComboBox"/>
          >
          > Does anyone know if I have to add anything else, like refresh or
          > invalidate?

          The ClassFactory is like a rubber stamp that the dataGrid uses to create all
          of the itemRenderers. Changing the stamp doesn't change the images the
          stamp has already made, so I'm amazed you've had any success at all with
          this.

          Try reading up on Q2 in the FAQ

          http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf


          • 2. Re: ClassFactory
            iceflex Level 1
            Thank you, Amy
            • 3. Re: ClassFactory
              Level 7

              "iceflex" <webforumsuser@macromedia.com> wrote in message
              news:ge7id1$rnl$1@forums.macromedia.com...
              > Thank you, Amy

              You're welcome :-)