EJ2 Grid Delete Confirmation - Add Header

Is it possible to add a header to the delete/alert dialogs.




1 Reply

RR Rajapandi Ravi Syncfusion Team December 20, 2021 01:08 PM UTC

Hi Nick, 

Greetings from Syncfusion support 

From your update, we could see that you like to add the header to the delete confirmation dialog. Based on your query we have prepared a sample and achieved your requirement by using toolbarClick event of Grid. In this event we have created the custom dialog in the toolbarClick event. Please refer the below code example and sample for more information. 

toolbarClick: function (args) { //toolbarClick event 
    if (args.item.text === 'Delete') { 
      DialogObj = DialogUtility.confirm({ 
        title: 'Add your title here', 
        content: 'Are you sure want to Delete the Record?', 
        okButton: { text: 'OK', click: okClick.bind(this) }, //bind the click event for ok button and  
        cancelButton: { text: 'Cancel', click: cancelClick.bind(this) }, //bind the click event for cancel button 
        showCloseIcon: true, 
        closeOnEscape: true, 
      }); 
      DialogObj.width = 250; 
    } 
  }, 
function okClick(): void { 
  grid.editSettings.showDeleteConfirmDialog = false; 
  DialogObj.hide(); 
  grid.deleteRecord(); 
  grid.editSettings.showDeleteConfirmDialog = true; 
} 

function cancelClick(): void { 
  DialogObj.hide(); 
} 


Regards, 
Rajapandi R 


Loader.
Up arrow icon