vincentmorneau / material-apex

A Material Design Theme for Oracle APEX
https://apex.oracle.com/pls/apex/f?p=12192
MIT License
189 stars 51 forks source link

Modal Dialog - Cancel Dialog / Close Dialog Event #374

Open oliver-tr opened 5 years ago

oliver-tr commented 5 years ago

Hey folks,

I'm currently using the Material Theme with a dropdown menu, which opens a modal by defined dynamic action.

My modal has a close and a cancel button, but the Dialog Close event is not triggered. How can I achieve this. I want a region to be updated on "close" and I want no action to be triggered on "Cancel".

Thanks in advance, Oliver

oliver-tr commented 5 years ago

Any idea how to solve this issue?

minia68 commented 5 years ago

Hi, we need more info. Show the js code that open a modal. What is the type of modal(on same page or another)? Do you trigger "Dialog close" event, where you listen to it?

vincentmorneau commented 5 years ago

@oliver-tr are you talking about a modal page or a modal region?

oliver-tr commented 5 years ago

@vincentmorneau I'm talking about a modal page... Thanks for your help!

oliver-tr commented 5 years ago

@minia68 @vincentmorneau : I used a classic report shown as dropdown. I also modified the template for this - so each link had it's own id. I was using this to trigger a dynamic action. The dynamic action used another plugin (but I also tried it with a link - generated with APEX_UTIL.PREPARE_URL(...)) to open a dialog.

WIthin this I used the id of the link as triggering element and the close dialog action used the same. Attached a few screenshots... And yes - the modal page is a seperate page NOT a region.

This is the dropdown menu with the id "myid1": Screenshot 2019-09-10 at 09 39 50

My attached dynamic action: Screenshot 2019-09-10 at 09 41 34

The Open Dialog plugin with the triggering element: Screenshot 2019-09-10 at 09 41 50

The modal with the defined actions: Screenshot 2019-09-10 at 09 44 26

The Close Dialog action with the triggering element: Screenshot 2019-09-10 at 09 46 30

The defined action behind "Dialog Closed" Screenshot 2019-09-10 at 09 53 35

And the actual output - there is no console output of the defined action: Screenshot 2019-09-10 at 09 46 43

oliver-tr commented 5 years ago

@minia68 @vincentmorneau Just let me know, if you need further information on this topic... Or could you setup a sample application on some apex workspace?

minia68 commented 5 years ago

You should listen to "Close dialog" event in parent page(Main page).

minia68 commented 5 years ago

In two last screens "Dialog Closed" event on Test modal page (which is modal page?). On Main page from first screen threre is no "Dialog Closed" event

oliver-tr commented 5 years ago

I changed this - it"s working in the sample page. Let me have a look at my real application.

oliver-tr commented 5 years ago

@minia68 @vincentmorneau It's not working in my real life application - even though I re-checked everything again. Attached the pictures.

Could it be because I'm using a select inside the modal? ...And this select triggers also something...

Screenshot 2019-09-10 at 10 21 35

Screenshot 2019-09-10 at 10 20 28 Screenshot 2019-09-10 at 10 20 41 Screenshot 2019-09-10 at 10 20 55 Screenshot 2019-09-10 at 10 21 09 Screenshot 2019-09-10 at 10 21 16

And the console output: Screenshot 2019-09-10 at 10 21 50

Thanks in advance guys!!!

oliver-tr commented 5 years ago

@minia68 @vincentmorneau

The sample triggers:

Screenshot 2019-09-10 at 11 00 31

The real app does not trigger - I renamed everything, but no success: Screenshot 2019-09-10 at 11 00 47

vincentmorneau commented 5 years ago

I see that Material APEX still registers the dialogclose event from your debug log.

Can you try this:

    $(document).on("dialogclose", function (event, object) {
        console.log(event, object);
                 // do something
    });