• Aditya Shastri
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hello experts!

 

I am trying to use a standard command link functionality in my VF page but for some reason the controller function is not being called (I know this by putting debug messages).

 

Can you help me spot my rookie's mistake?

 

Page:

 

<apex:page standardController="My_Request__c" action="{!doSometing}"  extensions="My_Request_View_Override" title="My Request" showHeader="true" id="myPageID" cache="false">

 

<apex:form id="myFormID"  >

 

<apex:pageBlock title="Request Products">

 

    <apex:pageBlockTable value="{!My_Request__c.Products__r}" var="product">

 

        <apex:column headerValue="Action">

 

<apex:commandLink action="{!delProd}" onClick="return window.confirm('Are you sure?');"  rendered="{!My_Request__c.Stage__c = 'Draft'}" id="clDelId" value="Del">
                <apex:param value="{!product.Id}" name="pid" />
            </apex:commandLink>

 

</apex:column> 

</apex:pageBlockTable>
   
 </apex:pageBlock>
     
</apex:form>

 

</apex:page>

 

 

Controller function:

 

public PageReference delProd(){
   

    try{
        if(ApexPages.currentPage().getParameters().get('pid') != ''){
        if (productID != null){
            ID productID = ApexPages.currentPage().getParameters().get('pid');
            List<Product__c> n = [select id from Product__c where Id =: productID ];
            if(n.size() > 0){
                delete n;
            }
        }
    }catch(DmlException e){
       
        }
    }
   
    return new Pagereference('/'+record.Id);
}

 

Thanks a bunch!!!

 

On a VF page, I have a pageBlockTable.  There are times where there are more than 1000 records in the collection to be rendered.  When this occurs, the Visualforce collection limit of 1000 is hit and the page doesn't load.  I need to figure out a creative solution for getting around this.  In the end...

 

  1. I need all records to render on the page. If I do any pagination, it'll happen client-side after the records are loaded in the HTML.  I know the first responses to this will be about whether I really need to have all those records on the page and how there is doubt about whether I need to, but for the purposes of this forum post, please work with me here.
  2. I want to keep the look and feel of a pageBlockTable if possible.

 

When not using pageBlockTables, I have used a construct similar to the following to get through a collection of more than 1000 items.

 

<apex:repeat value="{!myCollection}" var="item" rows="1000" first="0">
{!item.text}
</apex:repeat>
<apex:repeat value="{!myCollection}" var="item" rows="1000" first="1000">
{!item.text}
</apex:repeat>
<apex:repeat value="{!myCollection}" var="item" rows="1000" first="2000">
{!item.text}
</apex:repeat>

 

pageBlockTable has the rows and first parameters, but if I do that, I'd be getting a new pageBlockTable everytime.

 

The options I can think of are:

 

  • Get a creative solution from the forums to actually utilize the pageBlockTable (purpose of this post)
  • Use apex:dataTable and try to use style classes to mimix the pageBlockTable look and feel. This is a nice possibility I haven't tried yet.
  • Use apex:repeat tags and make up my own HTML styling

 

Any help is appreciated.

 

 

  • September 13, 2010
  • Like
  • 0