That event might be too late? But I'm guessing grid or model is null before then. Also, model may need to be bindable as well. Or you might need to call execute bindings. From the documentation:
Notice in this example that you use the preinitialize event to define the data binding. This is necessary because Flex triggers all data bindings at application startup when the source object dispatches the initialize event. For more information, see When data binding occurs <http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7cc8.html> . When data binding occurs Binding occurs under the following circumstances: 1. The binding source dispatches an event because the source has been modified. This event can occur at any time during application execution. The event triggers Flex to copy the value of the source property to the destination property. 2. At application startup when the source object dispatches the initialize event. All data bindings are triggered once at application startup to initialize the destination property. To monitor data binding, you can define a binding watcher that triggers an event handler when a data binding occurs. For more information, see Defining binding watchers <http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7cc7.html> . The executeBindings() method of the UIComponent class executes all the bindings for which a UIComponent object is the destination. All containers and controls, as well as the Repeater component, extend the UIComponent class. The executeChildBindings()method of the Container and Repeater classes executes all of the bindings for which the child UIComponent components of a Container or Repeater class are destinations. All containers extend the Container class. These methods give you a way to execute bindings that do not occur as expected. By adding one line of code, such as a call to the executeChildBindings() method, you can update the user interface after making a change that does not cause bindings to execute. However, you should only use the executeBindings() method when you are sure that bindings do not execute automatically. http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf64c3d-7fff.html On Friday, February 20, 2015, mark goldin <[email protected]> wrote: > I am trying to replicate mxml binding for datagrid: > dataProvider="{_model.currentView}" > > with ActionScript: > > creationComplete="init()" > > > init: > BindingUtils.bindProperty(grid, "dataProvider", _model, "currentView"); > > override public function set dataProvider(value:Object):void > { > super.dataProvider = value; > if (value) > showData(); > } > > I am getting into set dataProvider only once when value is null. As a > result I see no data. > Any help? > > Thanks >
