Tuesday, June 25, 2013
Well here is a much awaited and the needed update for the PageBlockTable Enhancer plugin. Ever since I coded the first version, there were request for many features and this 2.2 version brings down some of them.
Here is what is new with this plugin
- Parameter to turn on and off Pagination.
- Support for specifying available page sizes.
- Support for choosing default page size on page load.
List o Parameters
- targetPbTableIds : comma-separated Ids of the target Pageblock tables
- paginate : Assign true if you want to use the pagination feature,default value is true.
- pageSizeOptions : A comma seperated list of integer values that will displayed as dropdown for page size
- defaultPageSize : Default page size that needs to be selected (at page load).
Ajax/Rerender support
- This version brings in support for rendering, the earlier version wasn't able to handle this. So incase you are rerendering your table or the parent components, you can call the "initPageBlockTableEnhancer()" method from "oncomplete" even of your commandButtons/actionFunctions/actionSupport/commandLink .
<apex:commandButton value="Rerender" reRender="mid" oncomplete="initPageBlockTableEnhancer()"/>
Basic Syntax
The basic syntax remains same, just few added params.
<c:PageBlockTableEnhancer targetPbTableIds="mid,mid2" paginate="true" defaultPageSize="5" pageSizeOptions="5,10,20,30,40,50,100"/>
<apex:pageBlock >
<apex:pageBlockTable value="{!accounts}" var="acc" id="mid">
<apex:column value="{!acc.Name}"/>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!accounts}" var="acc" id="mid2">
<apex:column value="{!acc.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
Demo And Installation / Unmanaged Package: http://blogforce9dev-developer-edition.ap1.force.com/ProjectDetail?id=a0290000007rdwd
[Updated @ 27-Nov-2013 : Bug Fixes related to sorting]