You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by "Patil, Virat" <vi...@capgemini.com> on 2014/04/01 15:15:35 UTC

Error while switching between renderers in mx:Tree

Hello

I have following code trying to switch between renderers at runtime. And Reassign data . I have tried using CallLater method to achieve it  Can somebody suggest a solution.

private function switchRenders():void{
                        if(multiSelect.selected)
                              listTree.itemRenderer = new ClassFactory(renderers.CheckBoxTreeItemRenderer);
                        else
                              listTree.itemRenderer = new ClassFactory(mx.controls.treeClasses.TreeItemRenderer);

}
Getting Following error:


TypeError: Error #1010: A term is undefined and has no properties.
                at mx.controls::List/createItemRenderer()
                at mx.controls::List/http://www.adobe.com/2006/flex/mx/internal::getMeasuringRenderer()
                at mx.controls::List/commitProperties()
                at mx.controls::Tree/commitProperties()
                at mx.core::UIComponent/validateProperties()
                at mx.managers::LayoutManager/validateProperties()
                at mx.managers::LayoutManager/doPhasedInstantiation()
                at mx.managers::LayoutManager/doPhasedInstantiationCallback()
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

Re: Error while switching between renderers in mx:Tree

Posted by Javier Guerrero GarcĂ­a <ja...@gmail.com>.
Define two states in your application, and either:

1. Define two mx:Trees, one with each item renderer, with includeIn for
each Tree set to each state, and just switch between states :)
2. Or just define one Tree, with itemRenderer.state1=itemRendererClass1,
and itemRenderer.state2=itemRendererClass2

I personally would go for option 1, since I have also had troubles
switching itemRenderers on execution time. Overhead is not a problem, since
the includeIn attrib is more or less the way to tell Flex "treat all this
as a comment unless you are in this state"  :)


On Tue, Apr 1, 2014 at 3:15 PM, Patil, Virat <vi...@capgemini.com>wrote:

> Hello
>
> I have following code trying to switch between renderers at runtime. And
> Reassign data . I have tried using CallLater method to achieve it  Can
> somebody suggest a solution.
>
> private function switchRenders():void{
>                         if(multiSelect.selected)
>                               listTree.itemRenderer = new
> ClassFactory(renderers.CheckBoxTreeItemRenderer);
>                         else
>                               listTree.itemRenderer = new
> ClassFactory(mx.controls.treeClasses.TreeItemRenderer);
>
> }
> Getting Following error:
>
>
> TypeError: Error #1010: A term is undefined and has no properties.
>                 at mx.controls::List/createItemRenderer()
>                 at mx.controls::List/
> http://www.adobe.com/2006/flex/mx/internal::getMeasuringRenderer()
>                 at mx.controls::List/commitProperties()
>                 at mx.controls::Tree/commitProperties()
>                 at mx.core::UIComponent/validateProperties()
>                 at mx.managers::LayoutManager/validateProperties()
>                 at mx.managers::LayoutManager/doPhasedInstantiation()
>                 at
> mx.managers::LayoutManager/doPhasedInstantiationCallback()
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient, you
> are not authorized to read, print, retain, copy, disseminate, distribute,
> or use this message or any part thereof. If you receive this message in
> error, please notify the sender immediately and delete all copies of this
> message.
>