cancel
Showing results for 
Search instead for 
Did you mean: 

Binding through this.getView (). ById ("myTable") does not work

former_member662683
Discoverer
0 Kudos
600

Hello everyone,

Problem with binding of 2 tables in the DetailDetail View. There is a table with elements in the MasterPage, by clicking on one of the elements i need to open a detailView with 2 tables (with different IDs) and transfer data to them. Data is in the same data model, but in different arrays.

this.getView().bindElement– binding first table successful

this.getView().byId("positionTable")– binding doesn't work

Detail.controller.js

	_onProductMatched: function (oEvent) {
			
			this._product = oEvent.getParameter("arguments").product || "0";
			this.index = oEvent.getParameter("arguments").index || "0";
			this.getView().bindElement({
				path: "/anfragekurzdata/" + this.index, 
				model: "detail-data"
			});
			
////////////what i need to bind. this code doesn't work
			var oTable = this.getView().byId("positionTable");
			oTable.bindElement({
				path: "/positionendata/" + this.index,
				model: "detail-data"
			});

Accepted Solutions (0)

Answers (1)

Answers (1)

MioYasutake
Active Contributor

Hi,

For binding tables, I would use bindItems or bindRows (in case of sap.ui.table.Table).

oTable.bindItems({ 
  path: "/positionendata/" + this.index,
  model: "detail-data"
})

If the data is not displayed, there could be issue in view.

Since you're using named model, all the property bindings need 'detail-data>' before property name.