1
votes

I want to add a customized button in oracle apex interactive grid to allow users to go back to the previous page. Can someone explain how I can do this in javascript? Thanks

2
window.document.location = document.referrer;Reza Saadati
@RezaSaadati using document.referrer is not a good idea because it is not as reliable as history.back() because it is for example gone after reloadPhilipp
What exactly do you mean by "the previous page"? Do you mean the page in the same application they navigated from, or any other page in any other application, or from the previous page in the breadcrumb hierarchy? Also, why does it need to be in the interactive grid, specifically?Jeffrey Kemp

2 Answers

2
votes

Without javascript (recommended):

  1. Create your button, let's say BTN_PREVIOUS, and a hidden page item, P1_PREVIOUS_PAGE
  2. Create a new branch:

Point: After Porcessing

Behavior Type: Page Identified by Item (Show only)

Item: Select your hidden item created on step 1 (P1_PREVIOUS_PAGE)

Server-side Condition: When Button Pressed, BTN_PREVIOUS

Now for every page that calls this one, you have to set the item P1_PREVIOUS_PAGE with the number of the calling page. There's innumerable ways to to this (through declarative list entries, URL, javascript), I recommend you to read https://docs.oracle.com/cd/E59726_01/doc.50/e39147/concept_url.htm

Obs: if you do the steps above, make sure that every other process, computation and branches have a server side condition, because this method relies on submitting the page and you don't want your "Previous" button triggering any other logic that you have already created.


With javascript:

  1. Create your button, let's say BTN_PREVIOUS;
  2. Create a dynamic action

When: Event: Click

Selection Type: Button

Button: BTN_PREVIOUS

Inside the dynamic action create a true action:

Action: Execute JavaScript code

Code: history.back()

Although the javascript way is simpler, it's always preferable to use what the tool (APEX) has to offer.

0
votes

You can use history.back() or if you want to go multiple steps back history.go(-2)