Order of calls to set functions when invoking a flex component

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-04-14T02:18:00Z Indexed on 2010/04/14 2:23 UTC
Read the original article Hit count: 278

Filed under:

I have a component called a TableDataViewer that contains the following pieces of data and their associated set functions:

        [Bindable]
        private var _dataSetLoader:DataSetLoader;
        public function get dataSetLoader():DataSetLoader {return _dataSetLoader;}
        public function set dataSetLoader(dataSetLoader:DataSetLoader):void {
            trace("setting dSL"); 
            _dataSetLoader = dataSetLoader;
        }

        [Bindable]
        private var _table:Table = null;
        public function set table(table:Table):void {
            trace("setting table");
            _table = table;
            _dataSetLoader.load(_table.definition.id, "viewData", _table.definition.id);
        }

This component is nested in another component as follows:

<ve:TableDataViewer width="100%" height="100%" paddingTop="10" dataSetLoader="{_openTable.dataSetLoader}"
    table="{_openTable.table}"/>

Looking at the trace in the logs, the call to set table is coming before the call to set dataSetLoader. Which is a real shame because set table() needs dataSetLoader to already be set in order to call its load() function.

So my question is, is there a way to enforce an order on the calls to the set functions when declaring a component?

© Stack Overflow or respective owner

Related posts about flex