Jun 03

If you didn’t already know, its easy to override javascript alerts and functions with your own code. This post is focused on showing you how to easily implement an Ext message box to replace the “confirmDelete” and the “window.alert” functions.

Amazingly it takes very little code to achieve some nice affects:

/* Override the APEX delete operation message prompt */
function confirmDelete(pMessage,pRequest) {
    Ext.MessageBox.confirm('Confirm', pMessage, function (btn) { if (btn == 'yes') doSubmit(pRequest); });
}
/* Override the default alert javascript message box */
if(document.getElementById) {
        window.alert = function(txt) {
                Ext.MessageBox.alert('Alert', txt, null);
        }
}

Note: you just need to ensure that these are placed somewhere on the page before your code calls them, preferably in your page header.

Delete Prompt Example:
APEX ExtJS - Delete Prompt

Window Alert Example:
APEX ExtJS - Messae Alert

2 Responses to “Oracle APEX & ExtJS Integration – Message Box & Prompts”

  1. Alf says:

    Hi folks!

    We are using apexlib in our project and when we try to integrate extjs message box, we have a trouble the cascade lovs fail and firebug report an “vFieldValue is undefined
    [Break on this error] vAjaxRequest.add(pLovEntry.oUsedFi…ace(/\:/g, String.fromCharCode(1))); ” error in apexlib-full.js line 6287.
    What can we try? tx in advance!

  2. mnolan says:

    From our experience, APEXLIB and Ext JS are not sociable, i.e. they don’t work together. We never bothered to investigate in much detail as we were looking to do a full Ext JS implementation and minimal jQuery. So we created our own cascading LOV solution based on the code from APEXLIB. I’m sure this is not the answer you want to hear, but since Patrick has joined Oracle APEXLIB is essentially dead, and most of the features will be in 4.0 anyway. My recommendation: either stick with jQuery and the plethora of open source plugins or make a full commitment to Ext JS and ditch APEXLIB. Otherwise I wish you luck debugging and I’d be interested to know if you resolve the issue.

    Cheers
    Matt

Leave a Reply

preload preload preload