This discussion is archived
5 Replies Latest reply: Feb 26, 2013 11:56 AM by pam499057 RSS

How to create a dynamic action from link column in classic report

pam499057 Newbie
Currently Being Moderated
I Have an apex page that display a modal window utilizing jquery. In the modal window I have a classic report with a link column that I want to capture its click event.
I was thinking I could create a dynamic action with selection type=jquery selector. Not for sure if I need to do anything on link column and do not know the syntax
for jquery selector. Would appreciate any help or direction???
  • 1. Re: How to create a dynamic action from link column in classic report
    fac586 Guru
    Currently Being Moderated
    pam499057 wrote:
    I Have an apex page that display a modal window utilizing jquery. In the modal window I have a classic report with a link column that I want to capture its click event.
    I was thinking I could create a dynamic action with selection type=jquery selector. Not for sure if I need to do anything on link column and do not know the syntax
    for jquery selector. Would appreciate any help or direction???
    Use a jQuery attribute selector to bind a dynamic action event handler to report column cells:
    td[headers="COLUMN_ALIAS"]
    and add a descendant selector to apply it to the contents of the cell, like a link:
    td[headers="HIREDATE"] a // Links in cells in HIREDATE column 
    Some examples:

    <li>{message:id=4570591}
    <li>{message:id=9689434}
    <li>{message:id=10378602}

    Unfortunately the examples on apex.oracle.com are currently broken due to an unknown problem with files in my workspace.
  • 2. Re: How to create a dynamic action from link column in classic report
    pam499057 Newbie
    Currently Being Moderated
    Thank you for your response. I am very new to Jquery so don't understand all that well.

    What I did:
    I created a dynamic action
    Event: Click
    Selection Type: jQuery Selector
    jQuery Selector: tdheaders

    Created True Actions
    I created an alert to see if this is being executed.
    Alert 'I made it here'

    What I have:

    I created a report region with the following query:

    Select empno, ename, 'SELECT' from emp
    where (ename like '%'||ltrim(rtrim(:P2_SEARCHPU))||'%'
    or :P2_SEARCHPU is null)

    I created 'SELECT' column as Link Column
    Report Attributes
    Link Text Select
    Target Page in this Application
    Page 2

    Region Header
    <div id="ModalForm2" title="Employee List" style="display:none">
    Region Footer
    </div>

    This report is displayed in a modal form when a button is clicked.
    Code for modal window in Page Header

    <script type="text/javascript">
    $( function() {
    $('#ModalForm2').dialog(
    { modal : true ,
    autoOpen : false ,
    buttons : {
    Cancel : function() {
    closeForm2();
    }

    }
    });
    });
    function openForm2()
    {
    $('#ModalForm2').dialog('open');
    }
    function closeForm2()
    {
    $('#ModalForm2 input[type="text"]').val('');
    $('#ModalForm2').dialog('close');
    }
    </script>

    I am trying to capture the click event on the link column of the report in the modal form. I want to pass a couple of column values
    back to the main form and close the modal window. I do not want to do the submit that happens if I click on the link column and link back to the main page(2)

    If I let the submit to happen, all other entered fields are cleared on my main form.

    Just don't understand the jQuery selector. I have no problem catching the button clicks on the modal form.
  • 3. Re: How to create a dynamic action from link column in classic report
    pam499057 Newbie
    Currently Being Moderated
    I meant to put

    jQuery Selector: tdheaders a

    But I did try :

    jQuery Selector: td [headers^="SELECT"] a
    td headers a
    td [headers^="SELECT"]

    It is not capturing the click event of the link column.
  • 4. Re: How to create a dynamic action from link column in classic report
    fac586 Guru
    Currently Being Moderated
    Always post code using <tt>\
    ...\
    </tt> tags as described in the FAQ.
    I created a report region with the following query:
    Select empno, ename, 'SELECT' from emp
    where (ename like '%'||ltrim(rtrim(:P2_SEARCHPU))||'%' 
    or :P2_SEARCHPU is null)
    There's no alias specified for the <tt>'SELECT'</tt> column, Oracle therefore uses the column contents as a default alias. This is
    'SELECT'
    rather than
    SELECT
    The required jQuery selector would therefore be:
    td[headers="\'SELECT\'"] a
    However the need to escape the single quotes everywhere is a bug waiting to happen. <tt>SELECT</tt> being an Oracle reserved word means using it as any kind of identifier isn't too clever either.

    You should always use a valid Oracle identifier as an explicit alias when a column contains a literal value or a complex expression:
    select
        empno
      , ename
      , 'SELECT' link_text
    from
        emp
    where
        (  ename like '%'||ltrim(rtrim(:P2_SEARCHPU))||'%' 
         or :P2_SEARCHPU is null)
    APEX will use the <tt>LINK_TEXT</tt> column alias as the ID attribute of the column header, and the column cells will reference this in their <tt>headers</tt>attributes. The jQuery selector is:
    td[headers="LINK_TEXT"] a
  • 5. Re: How to create a dynamic action from link column in classic report
    pam499057 Newbie
    Currently Being Moderated
    Thank you for your help.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points