ebs.getDeleteConfirmationOptions
Available in the context of ViewDisplayOptions (view form, Code tab > Display Options subtab) customizes the delete confirmation dialog for view records.
Syntax
ebs.getDeleteConfirmationOptions(selectedRowsData: any[], nameAttribute: string)
| Parameter | Description |
|---|---|
selectedRowsData
|
The data from the selected rows. |
|
|
The name of the nameAttribute of the main entity of the view. |
Response
The properties from ebs.getDeleteConfirmationOptions returned value overwrite the default properties defined on deleteConfirmation.
| Key | Description |
|---|---|
IViewDeleteConfirmationOptions
|
The view options as set in the request. |
Examples
In this example:
- On a view configuration page, Code tab > Display Options subtab, we customize the text displayed on the YES button to be “Yes delete x records”.
Request
ebs.createViewDisplayOptionsObject({
deleteConfirmation: {
yesButtonLabel: "Yes, sure",
noButtonLabel: "Nope",
getDeleteConfirmationOptions: function (selectedRowsData, nameAttribute) {
//console.log(selectedRowsData, nameAttribute);
var msg = "<h4>Are you sure you want to delete these records?</h4>";
var noOfRows = selectedRowsData.length;
var cancel = false;
for (var i = 0; i < noOfRows; i++) {
msg += "<div>" + selectedRowsData[i][nameAttribute] + "</div>";if(selectedRowsData[i]["a_status"] == "pending")cancel = true;}
if(cancel){
ebs.showMessage("You cannot delete pending records", "info");
}
return {
yesButtonLabel: "Yes delete " + noOfRows + "records",
message: msg,
cancelDelete: cancel
}
}
}
});
Response
The text displayed on the YES button will be “Yes delete x records” instead of the default value, that is, “Yes, sure”.
Because ebs.getDeleteConfirmationOptions does not return noButtonLabel, the text displayed on the NO button will be “Nope”, as defined on deleteConfirmation.
Because ebs.getDeleteConfirmationOptions does not return title and title is not defined on deleteConfirmation either, the title displayed on the confirmation box will be the default one.