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
gregusagregusa 

Edit & Delete Buttons not showing on StandardController PageBlockTable

I have a VisualForce page that I'm building to override the standard tab for a custom object we have.  So far it's working out great except for 3 issues:

1) The "Name" field when rendered in the table is not clickable -- so there is no way to browse to the detail page of the item.

2) I can't seem to find a way to render the "Edit" and "Delete" buttons, or even the checkbox to enable multi-select events.  I've tried a number of things but nothing works.

3) Notice the "New" Button, is there a better way to redirect to the standard New page for this custom object?

Thanks in advance!

Here's the page:

Code:
<apex:page standardController="Override__c" recordSetVar="over" tabStyle="Override__c">
  <apex:sectionHeader title="Overrides" subtitle="Home"></apex:sectionHeader>  
  <apex:form id="thePage">    
      <apex:actionRegion >
          <apex:outputLabel value="View: " for="viewList"></apex:outputLabel>
          <apex:selectList id="viewList" size="1" value="{!filterId}">
              <apex:actionSupport event="onchange" rerender="thePage, navigation" />
              <apex:selectOptions value="{!listviewoptions}" />              
          </apex:selectList>          
      </apex:actionRegion>
 <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="/setup/ui/recordtypeselect.jsp—ent=01I80000000Cpmi&retURL=%2Fa00%2Fo&save_new_url=%2Fa00%2Fe%3FretURL%3D%252Fa00%252Fo" value="New"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!over}" var="o" id="list"> <apex:column value="{!o.name}" /> <apex:column value="{!o.Override_Date__c}" /> <apex:column value="{!o.Advisor_Rep__c}" /> <apex:column value="{!o.Institution__c}" /> <apex:column value="{!o.Opportunity__c}" /> <apex:column value="{!o.Override_Amount__c}" /> </apex:pageBlockTable> </apex:pageBlock> <apex:panelGrid columns="2" id="navigation"> <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandLink> <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandLink> </apex:panelGrid> </apex:form> </apex:page>

 

MATTYBMEMATTYBME
For a clickable Name field try:


Code:
    <apex:pageBlockTable value="{!over}" var="o" id="list"> 
        <apex:column value="/{!o.Id}" target="_self">{!o.name}</apex:column>

 or replace column value with:

Code:
    <apex:pageBlockTable value="{!over}" var="o" id="list"> 
        <apex:outputLink value="/{!o.Id}" target="_self">{!o.name}</apex:outputLink>

 For the button you have to repeat what you have done for New button with the other buttons.


Code:
        <apex:commandButton action="/setup/ui/recordtypeselect.jsp—ent=01I80000000Cpmi&retURL=%2Fa00%2Fo&save_new_url=%2Fa00%2Fe%3FretURL%3D%252Fa00%252Fo" value="New"/>

        <apex:commandButton action="Your URL for Edit" value="Edit" />

        <apex:commandButton action="Your URL for Delete" value="Delete"/>

 And yes that is the best way to do it.


 

JimRaeJimRae
For the button, you should consider using the URLFOR method instead, it would be more portable and likely survive updates to the api better.


Code:
<apex:pageBlockButtons >
        <apex:commandButton value="New" action="{!URLFOR($Action.Override__c.New)}"/>
 </apex:pageBlockButtons>

 

gregusagregusa
Thanks to both of you.  Very close answers.  Here's what worked after trying it out:

1) The "Name" field when rendered in the table is not clickable -- so there is no way to browse to the detail page of the item.

ANSWER:
Code:
<apex:column ><apex:outputLink value="/{!o.Id}" target="_self">{!o.name}</apex:outputLink></apex:column> 

2) Render the "Edit" and "Delete" buttons.

ANSWER:
Code:
        <apex:column >
            <apex:outputLink value="{!URLFOR($Action.Override__c.Edit,o.id)}" style="font-weight: bold;">Edit</apex:outputLink> |&nbsp; 
             <apex:outputLink value="{!URLFOR($Action.Override__c.Delete,o.id)}" style="font-weight: bold;">Delete</apex:outputLink>
        </apex:column> 

3) Notice the "New" Button, is there a better way to redirect to the standard New page for this custom object?

ANSWER:
Code:
<apex:commandButton value="New" action="{!URLFOR($Action.Override__c.New)}"/>