on 04-06-2017 4:31 PM
Hi All , I'm using sap.m.table and i have to bind it cell by cell
there is my code in debugger
Any Help please !
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
just look at some sample table code, the way you are doing is completely wrong.
review what is aggregation binding
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jun, yes you are correct, binding is done incorrectly
Congrats for becoming member of the month 🙂
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.