VF page for line items in related list of opportunity.!

1.5k views Asked by At

I had created a VF page for related list of line items,I am trying to replace related list with that Vf page. I am struck with these things.Please help me.

1.I am having two record types which has different fields to display on its page layout. How can i get this?

2.I want to give show more option to user as on standard layout.So when clicked on it,it should show all products/Line items.

3.I want to give sorting ability on one field.Its custom sorting. How can i get this?Using jquery is only ??i am not aware of jquery.Please guide me.

4.I created action header with edit and del links.But del link doesnt work.It takes me to URL no Longer exists.

​Please help me.

this is my VF page:

<apex:page standardController="Opportunity"> 
   <apex:form > 
     <apex:pageBlock title="Products (Standard Price Book)"> 
      <apex:pageBlockButtons location="top" > 
       <apex:commandButton action="{!URLFOR($Action.OpportunityLineItem.AddProduct, Id)}" value="Add Product" /> 
         <apex:commandButton action="!URLFOR($Action.OpportunityLineItem.EditAllProduct, Id)}" value="Edit All" /> 
          <apex:commandButton action="{!URLFOR($Action.OpportunityLineItem.ChoosePriceBook, Id)}" value="Choose Price Book" /> 
   </apex:pageBlockButtons> 
   <apex:pageBlockTable value="{!Opportunity.OpportunityLineItems}" var="oli"> 
    <apex:column headerValue="Action">
       <b><apex:outputLink value="{!URLFOR($Action.OpportunityLineItem.Edit,      oli.Id)}">Edit</apex:outputLink></b>|<b><apex:outputLink value="  {!URLFOR($Action.OpportunityLineItem.Delete, oli.Id)}">Del</apex:outputLink></b>  
     </apex:column>
     <apex:column headerValue="Product"> 
      <apex:outputLink value="{!URLFOR( $Action.Product2.View  ,oli.PricebookEntry.Product2Id)}">{!oli.PricebookEntry.Name}</apex:outputLink> 
     </apex:column>
     <apex:column headerValue="Product Code"> 
     <apex:outputLink value="{!URLFOR( $Action.Product2.View  ,oli.PricebookEntry.Product2Id)}">{!oli.ProductCode}</apex:outputLink> 
     </apex:column>
     <apex:column headerValue="Sales Price Each"> 
     <apex:outputLink value="{!URLFOR( $Action.Product2.View  ,oli.PricebookEntry.Product2Id)}">{!oli.Unitprice}</apex:outputLink> 
     </apex:column>
     <apex:column headerValue="Quantity"> 
     <apex:outputLink value="{!URLFOR( $Action.Product2.View  ,oli.PricebookEntry.Product2Id)}">{!oli.Quantity}</apex:outputLink> 
     </apex:column>
     <apex:column headerValue="TotalPrice"> 
     <apex:outputLink value="{!URLFOR( $Action.Product2.View    ,oli.PricebookEntry.Product2Id)}">{!oli.TotalPrice}</apex:outputLink> 
     </apex:column>
   </apex:pageBlockTable>
  </apex:pageBlock> 
</apex:form> 

1

There are 1 answers

0
Jesal On

You will need to write an extension class to support your customisations.

1/ For recordtype, you will need to get Opportunity.RecordTypeId , and then in your Visualforce page:

<apex:outputpanel rendered="{!recordtype=='whatever id'}">
<apex:pageblock table>
<!-- show all your columns -->

2/ To show "all" have an outputlink to a new visualforce page, pass the OpportunityId and display all line items on that page

3/ Use this enhancer for your sorting - its very useful.

4/ Cannot tell why your delete doesn't work, is the line item already deleted?