3 Replies Latest reply: Dec 3, 2012 3:41 AM by Nicolette RSS

    dynamically add dynamic actions

    WimDeGroot
      Hi,
      I Apex 4.2 (o11g) have a report region , template 7, type "SQL Query (PL/SQL function body returnng...) that builds up with a VARIABLE amount of both rows and columns (I will make sure both can vary from 1 to only 50 rows and 10 cols max).
      This grid contains grid-points containing - (empty, unknown), N(o) or Y(es), and I wanna be able to click on any grid-point leading to flip into Y.
      I already found out that adding a dynamic action to a button in APEX enables me via a PL/SQL procedure to switch a value in the database-background, and via set_session_state I can have feedback the result on a control on the form.
      So now I "only" have to take following steps:
      - Make the dynamic pl/sql action work from a click on a normal text field (or display only)
      - Derive the actual dynamic action syntax so that I can add it on-the-fly to each grid-point in the dynamic report

      (I'm not bound to dynamic actioning ofcourse. Maybe an on-click element tag into a javascript can do the trick.
      I should be able to add it to the SQL string I dynamically build on load. )

      For both steps I would not now where to look.
      Suggestion are much appreciated.
      Thanks in advance
      Wim
        • 1. Re: dynamically add dynamic actions
          974630
          Wim

          If you use a jQuery selector for your dynamic action. You can bind the same dynamic action to multiple html items.
          And if you use live for the bind type then the dynamic action is also attached to the html item after a partial refresh of the region.

          What type of dynamic action is actual a good solution for you depents a what kind of information needs to be send to the server.
          1) Is the action for every input item the same. For instance set a indicator that a value in the region is changed by the user.
          A straight forward Execute PL/SQL as action type should be sufficient.

          2) Or does a value depending on the particular item changed needs to be used on the server. For instance do a update of the table for the changed column.
          You would need a Excute javascript as action type. And then in the javascript code call a ondemand process to execute the PL/SQL code.

          If you set up a demo/example of what you're trying to do we can help you better in filling in the blancs. And connect
          ing the dots.

          Nicolette
          • 2. How to call a procedure from a java script
            WimDeGroot
            Nicolette, thanks. Did not know of the reuseability of DA, may help me out sometime. But for this particular problem probably not, because I want to built the complete updatable report form dynamic (so no upfront adding of dynamic actions anyhow). I will change the subject title.
            My guess is I would be able to get this done if I only new:

            how to call a procedure (in the same workspace where APEX is running the forms) from a javascript in the header of the page?
            • 3. Re: How to call a procedure from a java script
              Nicolette
              Willem

              The search tems you're looking for are ondemand process or ajax callback.

              In [url https://forums.oracle.com/forums/thread.jspa?messageID=10390970&#10390970]this tread  there are 2 possibilities given to call a process you have defined on your apex page.
              This process is of type PL/SQL code and has an execution point "ondemand". The process does the actual execution of the pl/sql procedure.

              Nicolette