Skip to Content
0
Former Member
Aug 15, 2016 at 03:00 PM

getBindingInfo - how to avoid it?

1210 Views

Hi guys,

I have an app with an XML view and controller.

What I need to do basically is to put a table on the view, and items with binding - however the binding filter should be dynamic.

So right now I'm having a workaround, which I have a feeling is not so great.

Is there a better way to do this than what I did?

In the controller, I can't get the table's binding, but only the binding info which I think is not recommended to use.

What I also want to avoid is to first load the data without the filter, and then put the filter.

This is what the XML view looks like:

...

<Table

id="table"

items="{

path: '/Rules',

filters: [],

sorter: {

path: 'Name',

descending: false

}

}"

growing="true"

growingScrollToLoad="true"

updateFinished="onUpdateFinished">

...

and the controller:

...

onInit : function () {

oTable = this.byId("table");

var appId = "Something not static";

var oBinding = oTable.getBindingInfo("items");

oBinding.filters = [new sap.ui.model.Filter("ApplicationId", "EQ", appId)];

...

Thanks,

Or.