2 Replies Latest reply on Sep 16, 2009 3:17 AM by _Natasha_

    Switching Between Renderers At Runtime.

    flexprad09 Level 2

      Hello Members,

       

      I was trying to switch between DataGridColumnRenderers at Runtime depending on some condition in my programe.

      But what i did is not working till.

      I made this prototype to ask as to what i am missing. If anyone knows plz help.

      attached are renderers and application file.

       

      Any help appreciated.

       

      Thanks,

       

      Prad.

        • 1. Re: Switching Between Renderers At Runtime.
          _Natasha_ Level 4

          Hi,

           

          frankly speaking I don't understand this part:

          if(order==true)

          {

          var cf2:ClassFactory = new ClassFactory(DescendingLabelRenderer);

          orderColumn.itemRenderer = orderColumn.getItemRendererFactory(false,cf2);

          order= false;

          }

          else

          {

          var cf1:ClassFactory = new ClassFactory(LabelRenderer);

          orderColumn.itemRenderer = orderColumn.getItemRendererFactory(false,cf1);

          order = true;

          }

           

          why not:

          if(order==true)

          {

          var cf2:ClassFactory = new ClassFactory(DescendingLabelRenderer);

          orderColumn.itemRenderer = cf2;

          order= false;

          }

          else

          {

          var cf1:ClassFactory = new ClassFactory(LabelRenderer);

          orderColumn.itemRenderer = cf1;

          order = true;

          }

          • 2. Re: Switching Between Renderers At Runtime.
            flexprad09 Level 2

            Thanks Natasha,

             

            that was a stupid mistake though.

             

            Prad.