我有一張通過數據綁定填充數據的表格。現在在我的控制器中,我試圖循環所有數據綁定項目。這是我迄今爲止,但我不能得到它的工作。如何從控制器中的數據綁定中獲取1個項目?
colorRows : function(oTable) {
var items = oTable.getBinding("items");
var rowCount = items.length; //number of visible rows
var currentRowContext;
for (var i = 0; i < rowCount; i++) {
currentRowContext = items[i].getValue(); //this won't work
}
}
所以我需要從與匹配我的索引項目中獲得一個值。
編輯:我使用sap.m.table
是有可能的項目[I]不工作?我得到錯誤Uncaught TypeError:無法讀取未定義的屬性'getCells'。項目中有數據,但項目[i]導致未定義。 – freshrebel
@freshrebel我的不好,我已經更新了答案。對不起,誤導你。 – keshet
現在它的oModel.getProperty(sPath)不起作用。我得到錯誤:Uncaught TypeError:無法讀取未定義的屬性「長度」。其中aData未定義。 sPath由值/ InvoiceSet定義。 – freshrebel