javascriptoracle-apex

Custom Event not triggered on Modal Dialog Page


one of classic Report columns setted to be link and its javascript link which is javascript:$.event.trigger({type:'customEvent',id:'#ID#'}); Dynamic Action created with the following attributes:

When: custom
Custom Event: customEvent
Selection Type:  JavaScript Expression
 JavaScript Expression : document

the action is Execute javascript code:

console.log('event triggered')
var student_id = this.browserEvent.student_id
console.log(student_id)

this scenario working perfectly in Normal Page, but not in Modal Dialog Page. Why? Any suggestions?


Solution

  • I tried your code in Chrome and for me it was working, also in Modal Page. So not sure what the issue is. However, what you can do is use the APEX abstraction:

    javascript:apex.event.trigger(apex.gPageContext$, 'customEvent', {student_id: '#ID#'});
    
    When: custom
    Custom Event: customEvent
    Selection Type:  JavaScript Expression
     JavaScript Expression : apex.gPageContext$
    
    console.log('event triggered')
    var student_id = this.data.student_id
    console.log(student_id)
    

    See js doc apex.event.trigger