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
Girbson Bijou 8Girbson Bijou 8 

Display more than 1000 Line in visualforce

Please help me to display more than 1000 lines in a visualforce page.
public class InventoryCentralOficce {

      public List<AggregateResult> allproduct{get;set;}

     public InventoryCentralOficce() {

   allproduct = [
      
  SELECT Product_Hiden_Name__c, UM__c ,SUM(On_Hand__c)onHand,  SUM(Pending__c)pending,  SUM(Available__c)avail 
      FROM Articles_Containers__c 
      WHERE IsOpened__c = 1 AND FFP_Centers__c = 'Central Office'
GROUP BY Product_Hiden_Name__c , UM__c 
HAVING SUM(On_Hand__c) >0 
ORDER BY Product_Hiden_Name__c, UM__c limit 50000];
      
      

      }
}

 
Best Answer chosen by Girbson Bijou 8
Raj VakatiRaj Vakati
  you need to use the @ReadOnly annotation to enable the 1,000,000 row limit, which might look like this:


Per the VF documentation, it clearly states:


In addition to querying many more rows, the readOnly attribute also increases the maximum number of items in a collectionthat can be iterated over using components such as <apex:dataTable>, <apex:dataList>, and <apex:repeat>. This limit increased from 1,000 items to 10,000.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_readonly_context_pagelevel.htm
 
public class MerchandiseController {

    public List<Merchandise__c> getAllMerchandise() {
        List<Merchandise__c> theMerchandise = 
            [SELECT Name, Price__c FROM Merchandise__c LIMIT 10000];
        return(theMerchandise);
    }
}
<apex:page controller="MerchandiseController" readOnly="true">
    <p>Here is all the merchandise we have:</p>
    <apex:dataTable value="{!AllMerchandise}" var="product">
        <apex:column>
            <apex:facet name="header">Product</apex:facet>
            <apex:outputText value="{!product.Name}" />
        </apex:column>
        <apex:column>
            <apex:facet name="header">Price</apex:facet>
            <apex:outputText value="{!product.Price__c}" />
        </apex:column>
    </apex:dataTable>
</apex:page>