After playing around with the code for a bit, I've found a work-a-round. Well, it's more like a hack-a-round. I'm pretty sure there is better way to do this, but this is what I got:
if (data.status = "Success") {
$.messager.defaults.closable = false;
$.messager.defaults.cancel = '';
$.messager.confirm ('Success','Process was Successful',
function(r){
$('#tt').datagrid('clearChecked'); // Reset datagrid embedded in form
$('#tt').datagrid('clearSelections'); // Reset datagrid embedded in form
$('#dlg').dialog('close'); // Close dialog contained
$('#CalInput').submit(); // Submit the form to refresh data
}
);
$('.l-btn-empty').parent().parent().css('display', 'none');
} else {
.... More Code ....
}
After digging around at several old posts on simular issues, I came up with this hack.
Here is what I did:
1. I changed the type of messager from alert to confirm, this allowed me to trigger the function after a button was pressed. For whatever reason the function didn't seem to fire correctly with alert. Oh, and I had to give up the icons too by using confirm... a small price to pay.
2. I disabled the window close option to prevent the dialog from being close by the [X].
3. I set the text of Cancel to an empty string. While tracing through the code, I noticed that when changing the button string to empty, a unique class was used on the text object:
l-btn-empty4. Knowing the blank Cancel button's class, I was able to find the parent object of the button and change the style to hidden.
$('.l-btn-empty').parent().parent().css('display', 'none');I realizes this hack-a-round will probably break with a future version of something, but for now it does the trick. Hopefully in the future someone finds a more elegant way to address this problem. There is probably a way to change the button text to something unique and search on that text instead.
Oh well, I hope someone else finds this useful and improves upon it.
Regards,
Mark