2 Replies Latest reply: Dec 5, 2013 6:39 AM by Gus C RSS

    Convert To Dynamic Action

    Gus C

      Apex 4.2

      Theme 21

      Firefox

       

      At the moment I have a report that contains the following sql which produces a html button

       

      decode(status,'RUNNING',

      '<input type="button" name="stop_para" class="buttonred" value="Stop" id="P6_STOP_PARA" onclick="stop_paral(''stop_para'','''||queue_owner||''','''||queue||''');">' ,

      'STOPPED',

      '<input type="button" name="start_para" class="buttongreen" value="Start" id="P6_START_PARA" onclick="start_paral(''start_para'','''||queue_owner||''','''||queue||''');">'

      ) action

       

      In the page header I have some javascript

       

      function stop_paral(Request, q_owner, q_name){

      var answer=confirm("Do you really want to stop the listener of the parallel queue "+q_name+" of "+q_owner+"?");

      if(answer==true) {

        $x('P6_QUEUE_OWNER_ACTION').value = q_owner;

        $x('P6_QUEUE_NAME_ACTION').value = q_name;

        doSubmit(Request);

      }

      }

       

      function start_paral(Request, q_owner, q_name){

      var answer=confirm("Do you really want to start the listener of the parallel queue "+q_name+" of "+q_owner+"?");

      if(answer==true) {

        $x('P6_QUEUE_OWNER_ACTION').value = q_owner;

        $x('P6_QUEUE_NAME_ACTION').value = q_name;

        doSubmit(Request);

      }

      }

       

      I also have a 2 page processes

      p_scpapx.pr_6_stop_parallel_listener(:P6_QUEUE_OWNER_ACTION, :P6_QUEUE_NAME_ACTION);

      Request = Exp1

      stop_para

       

       

      p_scpapx.pr_6_start_parallel_listener(:P6_QUEUE_OWNER_ACTION, :P6_QUEUE_NAME_ACTION);

      Request = Exp1

      start_para

       

      Is there any way to replace some of this with dynamic actions

       

      Gus

        • 1. Re: Convert To Dynamic Action
          Tom Petrus

          Yes, there is. But honestly, typing out what I would do with it all is quite tiresome when I could simply implement it on apex.oracle.com. If you set up an example and share credentials of the workspace we/I can just shown you

          .

          In short, I would do this:

          • if status, queue_owner and queue are no columns in the ir, add them and set to hidden
          • make the action sql column NULL
          • make action a column link and assign it a class in the attributes, and add data attributes like "data-status", "data-queue-owner", "data-queue"
          • create a dynamic action to transform the column links into jquery buttons, depending on the value of data-status
          • create a dynamic action on click, cancel default event, confirm action, javascript action copying the value of data-queue-owner and queue to those 2 page items, and a plsql block executing that code while submitting those page items. Alternatively, combine this all in one javascript block/function.
          • 2. Re: Convert To Dynamic Action
            Gus C

            Thanks for your answer

            I will take a look

             

            Gus