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
HarithaAkellaHarithaAkella 

Visualforce Page - Number of rows issue

Hi,

I have created a visualforce page as per the requirement in my team and that looks like below image.
I am able to see only 20 rows in this table, whereas the original list view contains more than 1000 records.
I am on group edition on salesforce. 
My requirement :

1. I need to have all the 1000+ rows displayed on the same page, I just want to scroll down to see them all. (Right now in the imkage page I see a limit of only 20 rows, I want the same page to display all the rows)
2. i have implemented pagination after looking at few forums, The prev and next buttons that you see in the image. However clicking on any of them throws the error "Modified rows exist in the records collection! "

Please help me implement 1 , if not atleast 2 should be in working condition.

Thanks,
Haritha
User-added image
Gabriel C FerreiraGabriel C Ferreira
Hi,

Can you share the code you used to implement this page?
HarithaAkellaHarithaAkella
Its a VF code I have some html table in apex page! But the buttons are implemented as below? 
               <apex:commandButton value="previous" action="{!previous}"></apex:commandButton>
                <apex:commandButton value="next" action="{!next}"></apex:commandButton>
           
Gabriel C FerreiraGabriel C Ferreira

Seems that your controller are limiting the list that you're using to show the table. Try to see if your query doesn't have any LIMIT or similar clause that restricts the results.

Important: showing all the rows of your table may cause your page to exceed the limits of loading, isn't recommended showing all the rows.
Probably some code in your controller is causing the limitation to load the records and the bug when you try to paginate.

HarithaAkellaHarithaAkella
I do not even have a query ( Am on group edition and cant use SOQL query)
HarithaAkellaHarithaAkella
The result that you are seeing on this vf page is based on my list view! All the fields in this vf page are fields in my custom object "Orders", which is my controller!

Below is some of my code, to give you an idea:
My controller:
<apex:page showHeader="true" sidebar="true" standardController="NewOrder__c" recordSetVar="Orders" cache="false">

The filters you are seeing is nothing but my various list views I created by applying filters:

 <apex:form id="os1" >
    <div class="hideCurrDate">
        <apex:pageBlock title="Orders-Status as of {!Now()} " id="thePB" >
             <apex:pageMessages />
                 <apex:PageBlock title="Filter">
                         <apex:commandLink target="_blank" styleClass="btn" style="text-decoration:none;padding:4px;" 
action="https://koolgator.lightning.force.com/lightning/o/NewOrder__c/list?filterName=00B39000007z4UkEAI" value="ALL"/>

 <apex:commandLink target="_blank" styleClass="btn" style="text-decoration:none;padding:4px;" 
action="https://koolgator.lightning.force.com/lightning/o/NewOrder__c/list?filterName=00B39000007z4ZeEAI" value="IN PROGRESS"/>

            <apex:commandLink target="_blank" styleClass="btn" style="text-decoration:none;padding:4px;" 
action="https://koolgator.lightning.force.com/lightning/o/NewOrder__c/list?filterName=00B39000007z4ZoEAI" value="DELIVERED"/>

 <apex:commandLink target="_blank" styleClass="btn" style="text-decoration:none;padding:4px;" 
action="https://koolgator.lightning.force.com/lightning/o/NewOrder__c/list?filterName=00B39000007z4cEEAQ" value="COMPLETE"/>
</apex:PageBlock>
            <apex:pageBlockButtons >
                <apex:actionPoller action="{!quicksave}"  interval="30"/>
                <apex:commandButton value="Save" action="{!save}" oncomplete="rcode();"/>
                 <apex:commandButton value="Quick Save" action="{!quicksave}"/><br><br></br></br>
                    </apex:pageBlockButtons>
           
         
and then this is part of my table, SO__C etc are fields in Orders custom object:

<table value="{!Orders}" width="100%;font-size: 10px" var="opp" id="accsTable" styleclass="tablesorter">

 <td><apex:inputField value="{!ord.SO__c}" style="width: 30px;font-size: 10px"/></td>
 <td>   <apex:inputField value="{!ord.MPO__c}" style="width:30px;font-size: 10px"/> </td>
  <td>   <apex:inputField value="{!ord.PO__c}"  style="width:80px;font-size: 10px"/> </td>
  <td>   <apex:inputField value="{!ord.Account__c}" style="width:130px;font-size: 10px"/> </td>
  <td>   <apex:inputField value="{!ord.Name}" style="width:170px;font-size: 10px"/> </td>
HarithaAkellaHarithaAkella
Yes, I agree, But I atleast want my pagination to work, my next and prev buttons?
Gabriel C FerreiraGabriel C Ferreira
As you are using a standard List Controller in your page, you are limited to only 20 records by default. To bypass this limit, use a controller extension to set the pageSize to the limit you want to.
You can check this and how to make the pagination here: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_pagination.html

Another point: all visualforce tables and the repeat are limited to hold only 1000 records.

About pagination, are you sure that the rows have no changes when you hit the pagination buttons? Try to expose the fields with <apex:outputFields> to see if the pagination is working at least.
HarithaAkellaHarithaAkella
setPageSize() method on StandardSetController? I cant use this because I would have to create a class for it. In group edition I cant create apex classes , so I cannot extend classes in my standard controller vf page. Anything I do has to be on the vf page. And also I doubt if I can even use query since am on group as mentioned. 

I tried to run query earlier, but its disabled. When I researched I found that its not enabled for our edition. https://help.salesforce.com/articleView?id=code_about.htm&type=5

When I use apex pageblocktable and use the pageblock buttons for pagination they work for me. Problem is when I use the standard html table as mentioned in my code earlier instead of pageblocktable or datatable, these buttons, next prev they dont work.

Am pretty sure, because the moment I click on any of the buttons leads me to "Modified rows exist in the records collection! ​​​​​​​"


User-added image
Gabriel C FerreiraGabriel C Ferreira
Since you can't make any customization with Apex, i thing the only way is to use the pageblocktable and pageblock buttons to make the pagination work as the standard way for list controller.
I suppose you're making use of a html table because of your headers. You can try this make the "General Information" line in HTML. Then, add your pageblocktable with <apex:facet name="header"> with the values of last line of our header. Maybe you have to use some css to style and adjust the sizes to fit correctly, but maybe it will work for you.
HarithaAkellaHarithaAkella
I did the exact same thing yesterday! It worked. Ofcourse I still need to figure out the color coding of fields based on certain conditions which was easy to do in html. Need to figureout the same with pageblocktable.
Gabriel C FerreiraGabriel C Ferreira

You can use an IF statement in your outputField with your criteria and add css styles, something like that:

<apex:outputText value="{!opp.Name}" styleClass="{!if(opp.StageName='Closed Lost','closedClass', 'openClass')}"/>

Let me know if it worked.

HarithaAkellaHarithaAkella
I just figured out that the pagination problem is resolved when you have your pageblocktable fields as
<apex:column value="{!ord.SO__c}" style="width: 20px; height: 20px"/>

Once you change to InputText value, that's when we see the error "Modified rows exist in the records collection! "
<apex:column> <apex:InputText value="{!ord.SO__c}" style="width: 20px; height: 20px"/>  </apex:column>

But I have the requirement to input fields, I just dont want to view them, i should be able to edit them?
HarithaAkellaHarithaAkella
Hi,

My requirement is this:
<apex:column value="{!ord.RCVD_Order__c}" styleClass="{!if( AND ( NOT(ISBLANK(ord.RCVD_Art_work__c) ) ,ISBLANK(ord.RCVD_Order__c)),'background-color:yellow;width:20px','background-color:white;color:black;width:20px;font-size:10px')}""/>

This is not working!
Gabriel C FerreiraGabriel C Ferreira
Since you're using inline css, use style instead of styleclass
HarithaAkellaHarithaAkella
I really appreciate your quick responses! I have resolved that issue!

I am waitin on implementing pagination when pageblock table columns have InputText value, that's when we see the error "Modified rows exist in the records collection! " and my prev, next links wont work?

Does pagination not work with InputText?
HarithaAkellaHarithaAkella
Ok, I have found the solution for this! Just change the <apex:InputText > to <apex:InputField> , That solves the issue!