Search code examples
apache-flexitemrenderer

How do I revert back to the default item renderer in a spark list after applying a custom item renderer?


I have a flex spark list that is populated by a dynamically generated ArrayCollection (and is used in a recyclable component). If the Array Collection is less than 9 items, a checkbox item renderer is applied. If the ArrayCollection is greater than 8 items, I want to revert back to the default sparkList item Renderer. How do I remove the itemRenderer from the spark list?

if ((ac.length>0)&&(ac.length <=8))
{
    //implement a renderer in the control for check boxes - this works!
    this._s_g_ListBoxLong._list.itemRenderer = new ClassFactory(morris.renderers.Renderer_checkBoxes);
}
else if (ac.length >=9)
{
    //apply the default item renderer for a spark list or remove the itemRenderer pointer
    //?????  HOW DO I DO THIS?
}
else
{
    //do nothing
}
this._s_g_ListBoxLong._list.dataProvider = ac;

Solution

  • Try using DefaultItemRenderer.

    The DefaultItemRenderer class defines the default item renderer for a List control. The default item renderer just draws the text associated with each item in the list.

    this._s_g_ListBoxLong._list.itemRenderer = new ClassFactory(DefaultItemRenderer);