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
nagalakshminagalakshmi 

Disabling the action of hyper links in pdf when displaying the products from opportunities

Hi, 

 

I am displaying the products related list as a pdf through visual force page based on the opportunity id. the products lists are displayed with action column with edit and del command links. And product names havinf command link. I am removing the action column through the css. Like

 

.actionColumn{
display:none;
}

 

Now i want to disable the action when we click on the product name. When we click on the product name from pdf it will goes the record in salesforce. Please help me how to disable the action of product name in pdf.

 

 

Thanks,

Lakshmi.

Best Answer chosen by Admin (Salesforce Developers) 
LakshmanLakshman

I got it, you could get the list as below:

 

<apex:page standardController="Opportunity" renderAs="pdf">
<apex:pageblock>
 <apex:pageblocktable value="{!Opportunity.OpportunityLineItems}"  var="oli">
<!--Add respective columns here-->
 <apex:column value="{!oli.PricebookEntry.Name}"/> <apex:column value="{!oli.Quantity}"/> <apex:column value="{!oli.TotalPrice}"/> </apex:pageblocktable> </apex:pageblock> </apex:page>

 I have tested it and it works well. Please mark it as solved if it works for you.

 

Regards,

Lakshman

 

 

All Answers

cloudmaniacloudmania

You can use jquery to remove the action on the product link.

 

<script>

$("#pid").attr("href","#");

</script>

<a href=".."  id="pid">Your Product</a>

 

 

LakshmanLakshman

Try using below CSS:

 

.dataCell a{

   pointer-events: none;   

   cursor: default;

}

 

Please Note that this only works in: Firefox 3.6+, Safari 3+ & Chrome 5+

 

Let me know if this works for you.

 

Regards,

Lakshman


nagalakshminagalakshmi

Hi,

 

Thanks for your reply. I am using the below tag for displaying the products based on opportunity id and i use the script which you have posted. But it is not working. Please help me

 

<apex:relatedList subject="{!Opportunity}" list="OpportunityLineItems" id="pid"/>

 

Thanks,

Lakshmi.

 

nagalakshminagalakshmi

Hi Lakshman,

 

Thanks for your reply. I am using the below tag for displaying the products based on opportunity id. If i use the css style which you posted. How can i call the css for the below tag. I tried with

<div class=" datacell">

 <apex:relatedList subject="{!Opportunity}" list="OpportunityLineItems" />

</div>

Still it is not working. How can i solve this issue. Please help  me.

 

Thanks,

Lakshmi.

LakshmanLakshman

The link is not clickable for me. Try following code:

<style>
.dataCell a{
   pointer-events: none;   
   cursor: default;
}
.actionColumn{
display:none;
}
</style>

<apex:relatedList subject="{!Opportunity}" list="OpportunityLineItems" /> 

 Let me know which browser are you using.

 

Regards,

Lakshman

 

LakshmanLakshman

Lakshmi,

 

It works in browser but not in PDF. Strange part is that I am able to view the Edit and Del links in the PDF. Will let you know if I get a solution to this.

 

Regards,

Lakshman

cloudmaniacloudmania

You have to call my jquery solution on document.ready

 

<script>

$(document).ready({

.......

      });

</script>

nagalakshminagalakshmi

colud you please post the code in detail.

 

Thanks,

Lakshmi

cloudmaniacloudmania

try it

<apex:page renderAs="pdf">

<script>

$(document).ready(function(){

                $("#pid").attr("href","#");

          });

</script>

<a href="your target page" id="pid">Product</a>

</apex:page>

cloudmaniacloudmania

Of course you have to add the base jquery library.

 Here is the latest release > http://code.jquery.com/jquery-1.7.js

 

<apex:includescript value="http://code.jquery.com/jquery-1.7.js"/>

nagalakshminagalakshmi

Hi, 

 

It is working in visual force page. But not working in pdf(renderas="pdf")of visual force page. I tried a lot but not getting. Please help me how to solve this issue. Thanks in advance.

 

 

Thanks,

Lakshmi.

nagalakshminagalakshmi

Hi,

 where i can add the inputscript tag in my code.

LakshmanLakshman

Lakshmi,

 

The only solution I find is like to build the custom related list using <apex:pageblocktable> which will have list of OpporunityLineItem coming from a controller or extension.

 

I am sure it will work for you as you will have complete control on the values. Let me know if it works.

 

Regards,

Lakshman

nagalakshminagalakshmi

Hi lakshman,

Thanks for your reply but it is professional edition.there is no classes. 

 

Thanks,

Lakshmi

LakshmanLakshman

I got it, you could get the list as below:

 

<apex:page standardController="Opportunity" renderAs="pdf">
<apex:pageblock>
 <apex:pageblocktable value="{!Opportunity.OpportunityLineItems}"  var="oli">
<!--Add respective columns here-->
 <apex:column value="{!oli.PricebookEntry.Name}"/> <apex:column value="{!oli.Quantity}"/> <apex:column value="{!oli.TotalPrice}"/> </apex:pageblocktable> </apex:pageblock> </apex:page>

 I have tested it and it works well. Please mark it as solved if it works for you.

 

Regards,

Lakshman

 

 

This was selected as the best answer
nagalakshminagalakshmi

hi lakshman,

 

Thanks a lot ite working fine....

 

Thanks,

Lakshmi.