Skip to Content
0

When does binding happen?

Feb 07, 2017 at 06:22 PM

223

avatar image

Hi all,

appreciate your help on the following -

I have an application with an XML view. In the view I have a grid and I would like to define a filter for this grid in the view's controller.

However when I first enter the oninit the binding is undefined. If I get back to the same view later on using a back button this works fine.

whena view is loaded when is the binding done?

The view and controller:

.....
<l:Grid id="masterGridCont" content="{path :'sign>/categories' , sorter : { path : 'sign>name', descending : false }}">
<ObjectListItem title="{sign>name}" icon="{sign>image}"></ObjectListItem>
</>
......

......

onInit: function() { this.getRouter().getRoute("mastergrid").attachPatternMatched(this._loaCategory, this); }, _loadCategory: function(oEvent) { var oMasterGridCont = this.getView().byId("masterGridCont"); var oBinding = oMasterGridCont.getBinding("content");

......

}

......

Thanks in advance,

Liat

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Srikanth KV Feb 07, 2017 at 08:15 PM
0

Hi Liat,

When you access data with method getBinding then it implies that data is already loaded/available.

Imagine a scenario like this where you have around 2000 rows of data getting loaded and rendered as part of XML view binding, and loading of data may take several seconds based on database connectivity(eg: assume it as 10 sec load time). At the same time from onInit method you are trying to access the data which is still loading. This is reason why you are not able to access data during onInit but the same can be accessed after sometime or any other button click.

To resolve this scenario you need to identify when the data load is completed from the server, for this you can subscribe to binding event dataReceived

Srikanth

Share
10 |10000 characters needed characters left characters exceeded