function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
uptime_andrewuptime_andrew 

View Page - "Back to" link and Quick Links at top of page

Is there a way to mimic the "Back to" link and top quick links (to related lists) at the top of a visualforce page?

 

 

Ritesh AswaneyRitesh Aswaney

You could pass in the link you want to return back to as a query parameter, like salesforce does using the returl query parameter.

 

You could then render a link, which re-directs you back to the url constructed by using the value of the query parameter passed in.

 

http://apexsutherland.wordpress.com/2009/05/09/return-the-account-merge-wizard-to-beginning-upon-completion/

vhanson222vhanson222

Below is some javascript that i used to mimick the quicklinks (to related lists) at the top of a page (requires jQuery):

 

 

/** div to hold the mini related list that will appear on hover **/
<div id="miniRL" style="display:none;"></div>
/** JAVASCRIPT **/
		<script>
			var j$ = jQuery.noConflict();
			var rlWidth;
			var showHover;
			
			function ShowDialog(posArray)
			{
				j$("#miniRL").dialog({
					autoOpen: true,
					draggable: false,
					resizable: false,
					width: rlWidth,
					position: posArray
				});
				
				j$("#miniRL").dialog("open").parent().appendTo(j$("#page\\:tabDetails"));
				
				// remove the default dialog style
				j$('.ui-dialog-titlebar').removeClass();
				formatDialog();
			}
			
			function formatDialog()
			{
				j$('.ui-dialog').removeAttr('class');
				j$('#miniRL').removeAttr('class');
				j$('.ui-dialog-title').parent().remove();
				j$("#miniRL").parent().addClass("shadow");
			}
		
			j$(document).ready(
				function() {
					
					// lines below are workaround for a bug in jquery
					//ShowDialog([0,j$(".linklet").offset().top - j$(document).scrollTop()+20]);
					//closeNow();
					
					j$("#miniRL").hover(function() {
						showHover = true;
					},
					function(){
						showHover = false;
						closeDialog();
					});
					
					j$(".linklet").hover(function() {
						showHover = true;
						var divId = getDivId(this.toString());
						divId = divId + "_RL";
						
						var x = j$("#bodyCell").offset().left + 10;
    					var y = j$(this).offset().top - j$(document).scrollTop()+20;
    					var posArray = [x,y];
						j$("#miniRL").empty();
						j$("#page\\:" + divId).clone().appendTo("#miniRL");
						
						rlWidth = j$("#bodyCell").width();
						
						ShowDialog(posArray);
						j$("#miniRL").css("display","inline");
						j$(".ui-dialog-titlebar-close").hide();
					},
					function() {
						showHover = false;
						closeDialog();
					});
					
				});
				
				function closeDialog()
				{
					setTimeout("closeNow()",400);
				}
				
				function closeNow()
				{
					if (!showHover)
						j$("#miniRL").dialog("close"); 
				}
				
				function getDivId(theId)
				{
				
					var i = theId.indexOf("#");
					var end = theId.length;
					var retVal = theId.substring(i+1, end);
					return retVal;
				}
		</script>

/** this is an example of how your related list tags should look towards the bottom of the page **/
/** ALSO NOTE: you must put "_RL" at the end of the apex:relatedList id so that it is parsed properly in the javascript above **/
<apex:relatedList list="YourCustomObject__c" id="YourCustomObjectId_RL" />

 hope that helps.

 

uptime_andrewuptime_andrew

Thanks for posting the code!

 

I have tried to use it, but was first getting the following error:

 

j$("#miniRL").dialog is not a function.  (in the closeNow function)

 

I'm including jquery-1.4.4.min.js and jquery-ui-1.8.10.custom.min.js - is there a specific jquery version you're using?

 

I commented out the offending lines, but the page doesn't do anything.  Were you hardcoding the relatedList links for the top of the page, with references to the jquery?