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
MPIMPI 

Professional Edition Workaround - Changing Record Set/Page Size

After an hour or two of frustration at the fact that there's no way to change the number of records returned by a record set (the pageSize property) without creating a Controller Extension which the Professional Edition can't do, I finally figured out a workaround.

The workaround involves linking an apex:inputHidden to the pageSize property as such:

<apex:inputHidden value='{!pageSize}' id='PageSize'/>

I then create an apex:actionFunction which will allow me to refresh my form once I've changed the size of the record set:

<apex:actionFunction name='refresh_list' rerender='myForm'/>

I then use javascript to change the value of that input field and reRender the form:

<script type='text/javascript'>
document.getElementById('myPage:myForm:PageSize').value = 50;
refresh_list();
</script>



Full Code:

<apex:page standardController='User' recordSetVar='users' id='UsersPage'>
<apex:form id='myForm'>
<apex:inputHidden value='{!pageSize}' id='PageSize'/>
<apex:actionFunction name='refresh_list' rerender='myForm'/>
<apex:pageBlock>
<apex:pageBlockTable value='{!users}' var='u' rows='50'>
<apex:column value='{!u.name}'/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
<script type='text/javascript'>
document.getElementById('UsersPage:myForm:PageSize').value = 50;
refresh_list();
</script>
</apex:page>

Message Edited by YoriMPI on 12-11-2008 09:15 AM
MPIMPI
The same can be done with {!filterId} in a hiddenText to specify a View for the record set to use.
dchasmandchasman
I have another approach that I think you will like better, does not require all that machinery, and does not require an extra round trip and rerender cost. You can use the following trivial custom component (I named it setValue) and expression passing:

Code:
<apex:component>
    <apex:attribute name="from" type="String" assignTo="{!to}" description="TODO: Describe me"/>
    <apex:attribute name="to" type="String" description="TODO: Describe me"/>    
</apex:component>

and in your page:

Code:
<c:setValue from="2" to="{!pageSize}"/>

 
 

MPIMPI
Thanks, that worked.

Is there a listing of properties that can be changed in this way (for example pageSize and filterID) that I can look up? I've been trying for the last few hours to find a variable like this that I can use to change the subject/recordID.

This would be more or less solved immediately if we just had a way to pass the subject to an apex:include statement the way you can with an s-control.


Message Edited by YoriMPI on 12-12-2008 12:11 PM

Message Edited by YoriMPI on 12-12-2008 12:22 PM
dchasmandchasman
Why are you using apex:include instead of just creating a custom component? apex:include predates custom components and is only still around for backward compatibility. A custom component has a well defined mechanism for specifying the inputs to the included content via attributes and also has the added advantage of passing objects and expressions instead of just query params/name value pairs...
MPIMPI
Seemed the most reasonable thing to use. I come from a programming background so using include seemed obvious. Also custom component sounded very similar to custom extensions (not available to Professional). The lack of documentation didn't help either, especially since it would have been trivial to simply add to the online documentation a note about apex:include being deprecated.