5 Ответы Последний ответ: 05.12.2018 19:48, автор: micles

    Dialog close event escape tab

    micles

      Hello everyone, I have a problem capturing the "escape" event for a modal dialog page.

      First, as read on the forum, I put my "close" in the dialog attributes like this:

       

      close: function (event, ui) {sepaq.dialogCloseEvent (event, ui, {dialogPageId: '& APP_PAGE_ID.'});

       

      My fonction:

       

      sepaq.dialogCloseEvent = function (event, ui, dialogPageId) {  
           const escape = 'Escape'  
           const type = ($(event).attr('originalEvent')) ? event.originalEvent.type : '' 
          
           apex.debug.info('dialogCloseEvent %s', dialogPageId) 
           apex.debug.info($(event).attr('originalEvent'))  
          
           switch (type) {  
                case 'click': 
                     apex.navigation.dialog.close(true, dialogPageId)  
                     break  
                case 'keydown':  
                     let keypress = $(event.originalEvent.originalEvent).attr('key')  
                     if (keypress === escape) { 
                          apex.navigation.dialog.close(true, dialogPageId) 
                     }  
                     break  
                default:  
                     break 
           } 
      }
      On my parent page I must always receive the event closedialog .... not cancel. 

      To capture the closure of the dialog with the X icon, there is no problem. the event.originalEvent.type is "click"
      But I am unable to catch the "escape" tab event that closes the dialog  ... my code does not work.

      ($ (event) .attr ('originalEvent')) is always undefined.

      Can anyone help ?






        • 1. Re: Dialog close event escape tab
          John Snyders-Oracle

          Hi,

          I don't recommend putting code in the Dialog: Attributes attribute. If we intended code to go in there we would have made it a text area with code editor rather than a text field in page designer.

           

          Perhaps you can explain what you are trying to accomplish. Your handler seems to just be doing what APEX would normally do which is close the dialog (apex.navigation.dialog.close).

           

          If you want to handle the dialog close on the parent page no matter if it is close or cancel you may be interested in the dialogclose event. You can specify this as a custom DA event.

          For example:

          Regards,
          -John

          1 пользователь считает эту информацию полезной
          • 2. Re: Dialog close event escape tab
            micles

            In your event, it's possible to know which dialog page is closed ?

            • 3. Re: Dialog close event escape tab
              micles

              For your information, i have on my page more call to different dialog page.

              I must do action on parent page when the dialog is closed ( cancel also ).

              • 4. Re: Dialog close event escape tab
                micles

                Your suggestion is better than mine. Does the dialogclose event return the "triggeringElement"?

                Dialog Initialization Code
                apex.navigation.dialog (#PAGE_URL # {title: # TITLE #, height: # # DIALOG_HEIGHT, width: # # DIALOG_WIDTH, maxWidth: # # DIALOG_MAX_WIDTH, modal: # # IS_MODAL, dialog: #DIALOG #, # # DIALOG_ATTRIBUTES }, 't-Dialog-page - standard' + # DIALOG_CSS_CLASSES #, # TRIGGERING_ELEMENT #)

                • 5. Re: Dialog close event escape tab
                  micles

                  I resolve all my problem.

                  I remove my dialog attribut.

                  I create one custom event  (for commun process) for my all dialog when is closed  ( example of John )

                   

                  I create  dialog close event for my specific action for each dialog

                   

                   

                  Thanks John.