Showing posts with label Sortable Pageblock Table. Show all posts
Showing posts with label Sortable Pageblock Table. Show all posts

Thursday, November 28, 2013


On my quest to create a perfect PageBlockTable, I tried a lot of jQuery plugin available out there. The main moto was to bring as many as feature I can. Some of them were good but were almost dead and were at end of their lifetime. Others were not compatible with Visualforce, some were not able to pick the standard pageblock table and other had css issues. Finally after long search I stopped on two plugins

  • TableSorter
     Description : tablesorter is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell.

    I find it very interesting because its very minimal and doesn't changes the DOM much and easily attaches itself VF Pageblocktable. All the version of PageblockTableEnhancer uses this to add Sorting and Pagination capability to a standard VF Pageblocktable. The combination really went well and I guess many of out there are using it now. This plugin is still actively developed and well be enhanced further but I don't think there is much scope to bring new features because its architecture is bit limiting
  • Datatables
    Description : DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table


    Datatable - looks futuristics isn't it ?


    Well Datatables ! everybody out there working on Dynamic Tables can't stop talking about it because of the amazing flexibilty and combination of features this gives. Features like Sorting,Pagination,Search can easily be implemented on very large table just using this table. And there is no boundaries support PDF/CSV export has been recently added and everyday some new plugin is introduced. Its the plugin of the future! Its still actively developed, there are lot of user already using this, new features are added and I see a lot of scope here!

So whats new ? 

I have been trying to combine Datatables with Standard VF Pageblock table. But somehow wasn't able to make them work together. But finally I was able to combine them and result is just awesome looking new table!.  Yes I was successfully able to combine them and create a new component called PageblocktableEnhancerADV(adv for Advanced, lol I know that sounds a bit funny ) .

I kept both of the plugin alive because people can choose from which one they want. If you like the Default look and feel you can go with PageblockTableEnhancer  else you can use the new PageblocktableEnhancerADV.

Personally I feel like there is lot of scope in PageblocktableEnhancerADV, since its based on Datatables there is lot scope and there is a long list feature waiting to be ported.

So Introducing the "PageblocktableEnhancerADV" with the backbone of "PageblocktableEnhancer", same ease of use, same set of parameters, just one line and  you are ready to rock!

Detail about the PageBlockTableEnhancerADV Component
(If you are using the PageblocktableEnhancer you should be aware about the basic parameters)

Here is what is new with this plugin
  1. Pagination Support.
  2. Support for specifying available page sizes.
  3. Support for choosing default page size on page load.
  4. Dynamic Search/filter
  5. No Coding and Changes Required in existing code.
  6. Hassle free installation

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 "initPageBlockTableEnhancerADV()" method from "oncomplete" even of your commandButtons/actionFunctions/actionSupport/commandLink .

    <apex:commandButton value="Rerender" reRender="mid" oncomplete="initPageBlockTableEnhancerADV()"/>
Basic Syntax
The basic syntax remains same, just few added params.

<c:PageBlockTableEnhancerADV targetPbTableIds="mid,mid2" paginate="true" defaultPageSize="5" pageSizeOptions="5,10,20,30,40,50,100"/>    
   <apex:pageBlock >   
     <apex:pageBlockTable value="{!contacts}" var="con" id="mid">   
      <apex:column value="{!con.Name}"/>   
     </apex:pageBlockTable>    
     <apex:pageBlockTable value="{!contacts}" var="con" id="mid2">   
      <apex:column value="{!con.Name}"/>   
     </apex:pageBlockTable>     
   </apex:pageBlock>  
PageBlockTableEnhacerADV - Optimized version of Datatable for VF




Future Enhancements

  • Export to CSV and PDF
  • Copy to clipboard
  • Print

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
  1. Parameter to turn on and off Pagination.
  2. Support for specifying available page sizes.
  3. 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]

Sunday, March 31, 2013


[Live Demo]


Note : A newer version of this plugin is released please check the same by clicking on this link

Well I have been working on this new component "PageblockTable Enhancer" for a while and am trying to merge all the functionality that were featured in my earlier components " Sortable Pageblock table" and "Enhanced PageBlock Table".

The version 2.0b brings in some exciting changes like inclusion of Pagination along with the Sorting capability.

Check out the demo of the newest version here




How to use?

Parameter :

  • targetPbTableIds : comma-separated Ids of the target Pageblock tables




 <c:PageBlockTableEnhancer targetPbTableIds="mid,mid2"/>    
   <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>





PS: This is a beta version of the plugin, some bug may exists, If you find one, I will be more than happy to resolve them.

Saturday, March 2, 2013




If you are going through my blog, few days back I pushed a new version of a Enchanced Pageblock Table. The main draw back of this component is to you have to modify your existing controller to provide the FieldList to the component.

But what If I give a new plugin that can work on existing Page block tables and that to without any code changes in the controller ?

So here is the initial version of The PageblockTableEnhancer, that can be included into existing page to enhance your existing PageBlockTables. Just include the component into the page and specify Ids of the target PageblockTable in csv format.

Features
Currently PageblockTableEnhancer  only supports sorting. You can apply sorting feature to any number of tables in a page by using a single PageblockTableEnhancer  component.

How to use?

Parameter :

  • targetPbTableIds : comma-separated Ids of the target Pageblock tables




 <c:PageBlockTableEnhancer targetPbTableIds="mid,mid2"/>    
   <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>  


Enhanced Page Block Tables



Codebase:




Sunday, February 24, 2013


Note : A newer version of this plugin is released please check the same by clicking on this link


I started working on this component as a part of my client requirement for giving a Pageblock  Table capability to sort columns by clicking the column header. That was the initial version of the component from the initial version of this component there was not much change but only few minor cosmetic changes.


Well currently am working on a newer version of this component that adds a client side pagination to the Pageblock Table. This post is just sneak peak of the component, about what is coming.
Here is a screenshot of a Pageblock generated by the new Component.


You can check the live demo of the new component here : https://blogforce9dev-developer-edition.ap1.force.com/EnhancedPageBlockTableDemo

Demo And Installation / Unmanaged Package: http://blogforce9dev-developer-edition.ap1.force.com/ProjectDetail?id=a0290000007rdwd

Would like to really gather some feedback about the component what do you think and what can be included into this component.


Thursday, August 23, 2012



This Version is no more actively developed and is deprecated. But we have developed two more Alternatives for the same which are much more fun and easy to implement






This is minor change to my Sortable Pageblock Table Component. This change adds some cosmetic changes like the "legendary" up and down arrow to so the direction of sorting.

If you haven't read about this component earlier you can always have a quick glance to my earlier post here .
(You can find details about implementing in the blog)

Demo
You can check the live demo from here(http://blogforce9dev-developer-edition.ap1.force.com/SortablePageblocktable)

Give the Code:
Well you can install the package from here (https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000M3ie)

Screens.




Monday, August 13, 2012


This Version is no more actively developed and is deprecated. But we have developed two more Alternatives for the same which are much more fun and easy to implement





How many times you have tried to create a Sort-able Page block table?
Well I personally tried the same lot of time but never got a plug n play solution, this always ended up with lots of changes in my controller class.

There are lot of work around Dynamic SOQL,Order by statement, List Sorting etc. Well most of them requires a lot of coding and changes in the visualforce page.
Most of time we need to display just a small list of sortable data ,to implement the same I guess writing apex classes and code is not a good idea.
So I tried writing visualforce component which uses jQuery table sorter to do the job.Well this component is very naive stage and needs some obvious enhancement like, ability to specify which fields to sort, proper images to display the sorting order.

How to use the component?

Parameters
sObjList : List of sObject To display
fieldList : List of field API names to display in the table as column. 

 <c:SortablePageBlockTable sObjList="{!accounts}" fieldList="{!fields}"/>                   



This Version is no more actively developed and is deprecated. But we have developed two more Alternatives for the same which are much more fun and easy to implement






Demo.

You can check the live demo from here(http://blogforce9dev-developer-edition.ap1.force.com/SortablePageblocktable)

Package/Installation
You can use this package to install the same in your org https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000M3iZ