The goal is to activate a button when a row is selected. However, the button remains disabled even after selecting a row.
Below is a snippet of the code as well as a screenshot showing the issue [error_1]:
onInit: function () {
var oViewModel,
iOriginalBusyDelay,
oTable = this.byId("table");
// Store the original value for busy indicator delay in the worklist table,
// so it can be restored later. Busy handling on the table is
// managed by the table itself.
iOriginalBusyDelay = oTable.getBusyIndicatorDelay();
// Maintains the search state
this._aTableSearchState = [];
this.oSemanticPage = this.byId("page");
this.oEditAction = this.byId("editAction");
oTable.attachSelectionChange(this.onTableSelection, this);
},
/* =========================================================== */
/* Event Handlers */
/* =========================================================== */
onTableSelection: function () {
var oTable = this.getView().byId("table");
var aSelectedItems = oTable.getSelectedItems();
if (aSelectedItems.length > 0) {
this.byId("test").setEnabled(true);
}