4 Replies Latest reply on Jan 15, 2018 5:14 PM by John Snyders-Oracle

    How to create Next/Previous buttons from IG results

    Soukaina IDRISSI

      Hi everyone,

      I created one IG that contain a list of Customers (Page 1), and i want to add previous and next buttons in Details Customer (Page 2), to see directly the next or the previous customer existing in the IG (even if i did a filter before in this IG), without return in the Page 1.


      I already did demonstration of this problem, on apex.oracle.com with this credentials:


      Workspace: ws_formation

      Username: asoukaina

      Password: s@boulah123


      I used the Application 96486 - Next Prev BTN IG.


      Thank you for help.

        • 1. Re: How to create Next/Previous buttons from IG results

          Hi Soukaina,


          I can suggest you one possible solution to achieve this.

          you can check there is a hidden item where you are passing customer id when you clicking from page 1 to page 2.


          so, you have to write two processes/Dynamic actions  one for fetching next customer id and another one for fetching previous customer id.


          1. create one process/Dynamic action to fetch next customer id and call this process by Next button.

             and then set the next customer id to your hidden item and refresh the region or reload the page.


          2. create another process/Dynamic action  to fetch previous customer id and call it from your previous button and set this value to hidden item available for cust id.



          This is one way you can achieve this.


          hope this helps you.




          • 2. Re: How to create Next/Previous buttons from IG results
            Soukaina IDRISSI

            Thank you Mr Jitendra for reply.

            But how and where can i create process to fetch to fetching next or previous customer id ?

            You can do traitement in demo application if you want.

            • 3. Re: How to create Next/Previous buttons from IG results
              LA County APEX

              First, you need to retain all of the record(s) in the IG into the hidden item to pass to the next page. Since I'm not familiar with the IG, I'm not sure what need to be done to get all records through a javascript. (I have a similar process to collect the primary key value into a hidden item to pass to the detail page).

              Likes Jitendra stated, there is a need to create the dynamic action to fetch the data for the next and previous button.

              You can take a look in my application on page 8 and page 10 (detail page).


              Workspace: ladevapex

              User Name: mydevfellow

              Password: Pa$$word1


              To test the application, after login, double click the on any record on the second region and click the next and previous button on the detail page.

              • 4. Re: How to create Next/Previous buttons from IG results
                John Snyders-Oracle


                I think the method described by LA County APEX could work. But in general the filtered result set on page 1 could be very large and it would be a waste to fetch all the records just to get all the IDs to pass on to page 2 (also it could overflow the size of a page item value). What page 2 wants is to know the SQL and filters of the customer list on page 1 so that it can recreate that result set and keep track of the current offset within it. Currently IG does not provide the API needed to get at this information.


                Depending on the details of page 1 and page 2 and if page 2 can be a modal dialog it would be most efficient to leverage the client side model already established by the IG on page 1. Page 2 wouldn't be its own page but an inline modal dialog region on page 1. The IG cookbook doesn't have exactly what you are looking for but the pages "Split Grid and Form Multi-edit" and "Edit in Dialog" should provide some ideas. (IG Cookbook is here APEX IG Cookbook for 5.1.4 – HardLikeSoftware )


                If page 2 must be an apex page and it can be a modal dialog page then I think it would still be possible to use the IG model on page 1. Page 1 would expose next/prev JavaScript functions for page 2 to call. This is tighter coupling than I usually like between a dialog and its parent/calling page but is reasonable in this case.


                Either way will require some non-trivial JavaScript but I believe using the IG model will provide the most efficient (fastest for the user) way.