Skip to main content
Participant
June 10, 2013
Question

problem - itemEditor is not refreshed on the screen when dataProvider is changed.

  • June 10, 2013
  • 1 reply
  • 883 views

Instance of SelectDivisionInput is used as itemEditor for component id="divisions" (extends LayoutComponent)

Method creationComplete is OK - dataProvider is populated; after that 

on some event changeFilter is called and after some work in method resultLoad dataProvider is changed (i've watched it on debugging)

but that changes does NOT appear on the screen.

<component:EMultiSelectRowArray id="divisions"

                                        data="{filter.divisions}"

                                        idDataName="divId"

                                        textDataName="divName"

                                        changeEventName="objectIdChanged"                           

                                        width="100%">

            <component:itemEditor>           

                <mx:Component>

                <directories:SelectDivisionInput objectId="{data.divId}"

                                                     text="{data.divName}"                                                                                                                                                         

                                                     editable="true"                                                    

                                                     width="100%"/>                                            

                </mx:Component>                    

            </component:itemEditor>                                                       

         </component:EMultiSelectRowArray>   

        

        

public class SelectDivisionInput extends SelectObjectCombo

{

    private static const LABEL_FIELD:String = "divName";

    private static const DATA_FIELD:String = "divId";

    [Bindable]

    public var filterIncludeNotActual:Boolean = false;   

   

    private var _listForResControl:Boolean = false;

    private var _creationComplete:Boolean = false;

   

    public function SelectDivisionInput()

    {

        super();       

        useAsTextInput = false;

        saveSpaceForButtons = false;

        manualShowOpenButton = true;

        showOpenButton = false;

        showSearchButton = false;       

        labelField = LABEL_FIELD;

        dataField  = DATA_FIELD;               

        addEventListener(FlexEvent.CREATION_COMPLETE, creationComplete);

    }

   

    public function changeFilter(event:LoadDivisionsFormEvent):void

    {

        filterIncludeNotActual = event.includeNotActual;       

        loadData();

    }

    private function creationComplete(event:FlexEvent):void

    {   

        _creationComplete = true;   

        loadData();

    }

       

    private function loadData():void

    {

        if ( _listForResControl )

        {

            var ev1:LoadDivisionsForResControlEvent =

                    new LoadDivisionsForResControlEvent(null);

            ev1.handler = new Callback( ev1, resultLoad );

            ev1.dispatch();

        }

        else

        {  

            var ev2:LoadDivisionsEvent = new LoadDivisionsEvent(null,filterIncludeNotActual);

            ev2.handler = new Callback(ev2, resultLoad);

            ev2.dispatch();

        }

    }

   

    private function resultLoad(event:CairngormEvent, result:ArrayCollection):void

    {

        dataProvider = new ArrayCollection(result.source);               

        var sort:Sort = new Sort();

        sort.fields = [new SortField(LABEL_FIELD, true)];       

        dataProvider.sort = sort;                   

    }

    public function set listForResControl( value:Boolean ):void

    {

        if (_listForResControl == value) return;

       

        _listForResControl = value;

       

        if (!_creationComplete) return;

       

        loadData();

    }

This topic has been closed for replies.

1 reply

Inspiring
June 10, 2013

try to remove the static from

private static const LABEL_FIELD:String = "divName";

and see how that works

greenbitAuthor
Participant
June 10, 2013

Well, I tried but it did not help. Anyway thanks for advice. Any more suggestions? or at least some hint

Inspiring
June 10, 2013

What are you trying to achieve with

        labelField = LABEL_FIELD;

        dataField  = DATA_FIELD;        

and what are the conents of the SelectObjectCombo class SelectDivisionInput inherits from?