I have a table in SAP UI5 which has a checkbox in one of the columns for each row. When this is clicked I want it to open a Dialog box and then the user either confirms or denies the operation.
On Confirmation the corresponding row for that checkbox will be removed from view. If the user Cancels the operation then I want to clear out the checkbox for that row.
I'm confused on how to tell my function which specific checkbox to clear out or how to tell what the active row is to remove it from view.
Here are some code snippets:
Checkbox Setup (and bound to JSON data):
wqTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Misread Photo"}),
template: new sap.ui.commons.CheckBox({change:removePhoto}).bindProperty("checked", "checked").bindProperty("visible", "visible"),
width: "100px",
hAlign: "Center"
}));
On the 'change' event I am calling the removePhoto function....which looks like this:
function removePhoto (oControlEvent) {
//sap.ui.core.routing.Router.getRouter("appRouter").navTo("homeView");
//selectedMIrowIndex = oEvent.getSource().getBindingContext().sPath;
var currLoc = new sap.ui.commons.Dialog("removePhotoPopup", {title: "Misread Photo Confirmation", modal: true,showCloseButton:false,closed:function(){
}});
currLoc.addButton(new sap.ui.commons.Button({text: "Confirm", press: function(){
currLoc.close();
}
}).addStyleClass('green-btn'));
currLoc.addButton(new sap.ui.commons.Button({text: "Cancel", press:function(){
oControlEvent.getSource().getId().setChecked(false);
currLoc.close();
}}).addStyleClass('red-btn'));
var oDialog = sap.ui.getCore().getControl("removePhotoPopup");
oDialog.open();
}
How do I get the correct element ID of the checkbox to clear it out and how would I grab the correct row to remove that line from view?