I'm not sure if I've added that call to the right place or not. I put it in the oData read success callback, and it doesn't seem to hit the 'get' ever. The button is always enabled.
Modified btnDsnSave to include:
enabled: "{/isSaveEnabled}"
Then modified the data pull as such:
oModel.read(dynamicUri, { async: true, success: function (oData, response) { var data = response.data.results; var jsonModel = new sap.ui.model.json.JSONModel(); jsonModel.setData({modelData: data}); utilities.getControlFromUI('btnDsnSave').setModel(jsonModel); oTable.setModel(jsonModel); oTable.bindRows("/modelData"); Object.defineProperty(jsonModel, "isSaveEnabled", { get: function () { return data.some(function(r) {return r.STATUS == 'I' || r.STATUS == 'C' || r.STATUS == 'D'}); } }); oTable.setBusy(false); }, error: function(oError){ .... } ....
But like I said, I put a break point inside the get of the Object.defineProperty() and it's never getting there as far as I can tell. Any ideas?