Forum Stats

  • 3,768,658 Users
  • 2,252,827 Discussions
  • 7,874,676 Comments

Discussions

Go to Specific place in interactive grid after refresh; preserve place I was working

Baonerges
Baonerges Member Posts: 106 Blue Ribbon
edited May 27, 2020 10:21AM in APEX Discussions

Hi Everyone,

I have built an application using an interactive grid. The user launches a modal page where they divide one job on the list into many. When they save, it inserts the new entries and the interactive grid page is refreshed. The issue is that it puts the user back to the beginning of the grid data. This makes the job annoying because the users are working through many pages of data and need to go back to where they were. Is there a way to go to the previous row which was updated or even the page?

This very recent thread asked the same question:

Set focus on specific row in Interactive Grid

I commented on it:

I created two items called P19_JOBNO and P19_RELEASE. The branch from my other page passes values to these. The idea is that in the interactive grid, I scroll right to these. var rec = apex.region("ProdList").widget().interactiveGrid("getViews", "grid").model.getRecord("117980");apex.region("ProdList").widget().interactiveGrid("getViews", "grid").setSelectedRecords([rec], true);

When I use the above code, it does nothing.

Once the dialog is submitted, the user needs to be taken back to the page and the row they were just working with in the interactive grid so the user can continue where they left off.

Any help would be greatly appreciated.

«1

Answers

  • Baonerges
    Baonerges Member Posts: 106 Blue Ribbon
    edited May 19, 2020 11:26AM

    Does anyone have any ideas on how to do this? Any help would be appreciated.

  • Baonerges
    Baonerges Member Posts: 106 Blue Ribbon
    edited May 26, 2020 12:06PM

    I have been working on a solution for this and have come across the following code as well:

    pastedImage_0.png

    With this code and also the above code, the issue seems to be with getting the record. Line 8 getActiveRecordId() returns null even when something is selected. Why does this method return null? When I use getActiveRecordId, what criteria is it using to get the active record? Notice below my dynamic action is returning null.

    pastedImage_5.png

  • InoL
    InoL Member Posts: 9,331 Gold Crown
    edited May 26, 2020 1:32PM
    Once the dialog is submitted, the user needs to be taken back to the page and the row they were just working with in the interactive grid so the user can continue where they left off.

    Depending on the situation that might be really easy. If you have a modal dialog page and a Close or Cancel Dialog DA, the calling page (with the IG) doesn't do anything. So, you are still on the same record when closing the modal dialog page.

    The problem starts when you come back from the Modal Dialog and refresh the IG. As indicated by John in the linked thread, it is not always possible to go to a specific record: For a row to be selected it must be rendered.

  • Baonerges
    Baonerges Member Posts: 106 Blue Ribbon
    edited May 26, 2020 2:18PM

    That is the exact issue. The cancel is not a problem. When I save the modal dialog, it closes the dialog and triggers apex.region("ProdList").refresh(); The page does not refresh, only the region. It also renders all rows on that page.

    The following code should work but it doesn't. I have been trying hard coded values but in the console it keeps returning Dynamic Action Fired: null.

    var rec = apex.region("ProdList").widget().interactiveGrid("getViews", "grid").model.getRecord("122659");

    Job 122659 is literally the first one on the page. Does the column being read only make any difference?

  • InoL
    InoL Member Posts: 9,331 Gold Crown
    edited May 26, 2020 2:40PM

    Are you using job ID as the primary key or ROWID? getRecord needs what you have set as primary key.

    Start by running your Javascript in the browse developer console. It makes it much easier to understand what is actually happening and if your code is correct:

    pastedImage_0.png

  • Baonerges
    Baonerges Member Posts: 106 Blue Ribbon
    edited May 26, 2020 3:46PM

    Wow. I didn't even know you could run code form there. I was running my code in dynamic actions over and over again... Thank you

    Here is what I am running in the dev console. I don't know why it says undefined but it is taking me to the correct record so it works.

    pastedImage_2.png

    I created a dynamic action which works with this code now. Which executes the code on Double Click and it works.

    pastedImage_3.png

    This code does not work with After Refresh though. I'm trying to figure out which Event would be best to use. I even tried Dialog Closed but it does nothing once the Dialog is closed. My dynamic actions are below. Once the modal window is closed, the IG region is refreshed then it should jump to the row that I hard coded.

    pastedImage_4.png

    Thanks for the help so far. Getting close!

  • Baonerges
    Baonerges Member Posts: 106 Blue Ribbon
    edited May 27, 2020 10:21AM

    So I've gone through most of the dynamic actions that make sense and they don't work. Actions like click, double click, key pressed etc all work, but it seems like the ones I would want like on Dialog Close or After Refresh do not work. Is this because the the refresh takes too long and the command doesn't fire properly?

  • Darlene R
    Darlene R Member Posts: 3 Green Ribbon

    I know this is a year old almost but would love to know if you found a solution to return the IG to the last page after a refresh()

  • Baonerges
    Baonerges Member Posts: 106 Blue Ribbon

    Hi Darlene, unfortunately no. I am in the process of migrating to APEX 20.2. If I see a solution for this there, I will post it. For now the users have gotten used to using the find button and column filters to find the information they are looking for.

  • Darlene R
    Darlene R Member Posts: 3 Green Ribbon

    Thanks for the quick response. It really seems that this would be the default behavior since most users would prefer to return to where they were working

    Baonergesuser7951335