Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have a simple table for displaying users...

<apex:page standardController="User" recordSetVar="Users" tabStyle="User">
  <apex:pageBlock >
  <apex:pageBlockSection title="Today’s usersRecords"> 
  <apex:form >
  <apex:pageBlockTable value="{!Users}" var="user" styleClass="list">
  <apex:column >
  <apex:facet name="header">Name</apex:facet>
  <apex:outputText value="{!user.Name}" />
  </apex:column>
   <apex:column >
  <apex:facet name="header">Push Email</apex:facet>
  <apex:inputCheckbox value="{!user.DM_APP_EMAIL__My_custom_field__c }" />
  </apex:column>
  </apex:pageBlockTable>
  <apex:pageBlock >
  <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}"/>
  </apex:pageBlockButtons>  
  </apex:pageBlock>
  </apex:form>
  </apex:pageBlockSection>
  </apex:pageBlock>
</apex:page>

It only displays 25 users. How do I display more users?

Note: I want to keep things simple. No controller if possible.

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

I'm afraid we don't have a good news for you ;)

http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_sosc_pagination.htm

By default, a list controller returns 20 records on the page. To control the number of records displayed on each page, use a controller extension to set the pageSize.

So you either display the previous / next controls or there's a setPageSize() method on StandardSetController...

share|improve this answer
add comment

I'm taking a look at what you're trying to do, and I think you might want to reconsider.

You have a list of records, you display a custom checkbox field, and then you want to save the changes.

This will work, but there something is going to happen that you may not be aware of. When you click the save button, you will be saving every record in the list. So if you have a list of 50 users, and you check just one of the boxes, all 50 users will have their last modified fields updated. In a way, it spoils your audit of what has actually changed in your user records. For some companies, this can create a compliance problem. You're also forcing the platform to do a lot more work than it needs to (updating 50 instead of 1).

I know you state you don't want a controller, but for this reason, I would suggest you at least consider using one. For mass edits like this, there is a tried-and-true pattern called a Wrapper Class. It allows you to select only the records you want to change for update. Your code then sifts through the selected records, and if only 3 need to change, then only three will change.

It does increase the complexity of your page, but I would suggest that in most instances it is worth it, and it is definitely a best practice.

share|improve this answer
    
I am just setting up test data and want it done quickly. Thanks for you concerns. –  dublintech Jan 31 '13 at 11:53
    
In that case, quick and dirty gets the job done. :-) –  Peter Jan 31 '13 at 12:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.