0
votes

I have an page item and an interactive grid on an apex page . Page item is of select list type and base on the selection the data in the grid changes. I have default Add row button in the grid to add rows . I want to refresh the grid after after click on the SAVE button in the grid. If the grid automatically refresh itself after a fixed interval of let's say 2 or 5 second that is also good for me.

For the current scenario the rows are getting added but are not reflecting on page in the interactive grid after clicking on SAVE but entries can be found in the table in the database. After reloading the page the entries are reflecting in the grid.

NOTE : I am working over a database link for fetching the data.

3
I do not really understand your situation. As far as I know, the add row button in the interactive grid, adds an empty new row within the interactive grid. After pressing the SAVE button, your changes are stored. Does the SAVE button visually remove the added row? Or do you perhaps, instead of the interactive grid, use the interactive report? and the add row button will open a new modal window where you can enter the details and after pressing SAVE, the modal is closed and you want that new row being represented in the report automatically? - Giliam
Yes ideally it should save the added row in the grid but for me after clicking on SAVE button visually the row is removed from grid and after reloading the page only it is visible.I believe this is because i am working over a database link and thus row is not getting return back in the grid. - Prashant_417

3 Answers

0
votes

When you add rows to your Interactive Grid and hit save button, it refreshes and you can see the IG updated.

In case you need to refresh the region or the page every 5/10 seconds, please follow these steps:

  1. Define a Static ID for the IG, for example "IG1".
  2. In the page attributes, navigate to Execute when Page Loads and enter:

    var model = apex.region("IG1").widget().interactiveGrid("getViews").grid.model;

    setInterval(function(){ model.fetchRecords(model._data); }, 10000);

This is going to refresh the IG every 10 seconds. You can set it to 2 or 5 seconds.

0
votes

I had something similair with filters, If I added a row that shouldnt show up due to the filter I had on it would still be there until I refreshed. Of maybe if I changed something so it should no longer show up, it saved, but still showed up.

What I did was do a page submit after saving.

I have a Dynamic Action on Click Selection type jQuery Selector and the selector being [data-action="save"]

Then the action is simply Submit page.

This way after you click save, it submits the whole page and reloads. Hope this does what you need.

0
votes

There is a way to hook upon the built-in save action of the interactive grid.

Steps below will create a custom event, listening to the interactivegridsave event. That event is fired by APEX after the Interactive Grid has completed its own save process. Make sure the event name is spelled correctly.

  • Create Dynamic Action
    • When → Custom
    • Custom Event → interactivegridsave
    • Selection Type → Region
    • Region → <your region>
      • Refresh action (maybe turn off Fire on Initialization)

I think this will help you.