Tuesday, 24 July 2012

Using Anchors in oracle apex

When creating an apex chart I put in a feature where the user could refresh the page after changing a select list value. This left me with a problem as the chart was at the bottom of the page and when the page reloaded  the focus was repositioned at the top meaning the user would have to scroll down. To fix this I used an anchor in the page and then navigated to the anchor in the branch of my page.
   I thought I'd blog this as I only saw how to do it as a throw away comment on a forum post and if like me you didn't know how to do this you may find this entry useful.

The technique is simple really create an anchor in the location I want the page to scroll to. In apex this would most likely be the top of a region so you can put it in the title of the region e.g.

<a name ="CHART" ></a>Hourly Report

CHART will be the anchor and Hourly Report the title of your region

Now if you have a branch that submits the page to refresh the graph then you can use the value of the anchor to navigate to that region.

To do this add #CHART (or # followed by your anchor value) to the "with these values" field under actions (branch to page in this application with the page set to the current page). Now that branch will take you to the anchor. this technique will work for anchors on other pages as well.

Note: if you look at the branch later it will redirect to a url like

Hope this helps

No comments:

Post a Comment