Skip to Content
0

binding cells to sap.m.table

Apr 06, 2017 at 03:31 PM

88

avatar image

Hi All , I'm using sap.m.table and i have to bind it cell by cell

there is my code in debugger

capture.png

Any Help please !

capture.png (44.0 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Ramzi Ben Abdallah Apr 07, 2017 at 09:45 AM
0

Dear All , thanks for your answers

Like you've said the binding it's completely wrong but likely it works now I've found the solution

there is my code :

	var oModel1 = this.getOwnerComponent().getModel();
			var oFilter = new sap.ui.model.Filter("IdQuery", sap.ui.model.FilterOperator.EQ, sQuery);
			oModel1.read("/LinesSet", {
				filters: [oFilter],
				urlParameters: {
					"$expand": "ToCells"
				},
				success: function(oData) {
					var rows = [];


					console.log(oData.results.length + "length line ");
					// debugger;
					for (var i = 0; i < oData.results.length; i++) {


						var cells1 = {};


						for (var j = 0; j < oData.results[i].ToCells.results.length; j++) {


							console.log(oData.results[i].ToCells.results[j].Value);
							cells1["COL" + j] = oData.results[i].ToCells.results[j].Value;


						}
						rows.push(cells1);


					}
					var oModelX = new sap.ui.model.json.JSONModel();


					oModelX.setData({


						rows: rows
					});
					oTable.setModel(oModelX);


					oTable.bindItems("/rows", function(index, context) {
						var obj = context.getObject();
						var row = new sap.m.ColumnListItem();


						for (var k in obj) {
							row.addCell(new sap.m.Text({
								text: obj[k]
							}));
						}


						return row;
					});
					oTable.rerender();
					oTable.setBusy(false);
				},
				error: function(oError) {
					oTable.setBusy(false);
					console.log("erroooooooooor expand");
				}
			});

Best Regards

Show 2 Share
10 |10000 characters needed characters left characters exceeded

i don't know where u learn the ui5......you are really going a different way.....kind of nonsense

0

thanks for your encouragement but I'm beginner and I'm trying hard to learn it

0
Jun Wu Apr 06, 2017 at 05:42 PM
0

just look at some sample table code, the way you are doing is completely wrong.

review what is aggregation binding

Share
10 |10000 characters needed characters left characters exceeded
Srikanth KV Apr 06, 2017 at 05:26 PM
0

you cannot use bind aggregation as the data retrieved using normal AJAX call in line 122.

Bind aggregation is possible only with oData or JSON model binding

Show 3 Share
10 |10000 characters needed characters left characters exceeded

I think he has the odata. (by looking at the name oData.results)

0

Hi Jun, yes you are correct, binding is done incorrectly

Congrats for becoming member of the month :-)

0

thanks:)

..

0