A bit of Introduction
PageBlockTableEnhancerADV is a plugin that lets you convert a normal VisualForce pageblock table into a datatable. The component internally uses the Datatables plugin to bring in features like sorting, filtering and pagination.
So what's new ?
So as planned this post is all about File Exports!, Yes files export is being ported from Datatables to PageBlockTableEnhancerADV. To export files PageBlockTableEnhancerADV uses the Datatable plugin TableTools. TableTools is very flexible plugin that hooks in to the Datatables API to give in an amazing set of exporting option.
So this version of PageBlockTableEnhancerADV with the help of TableTools brings in
- Export to PDF
- Export to CSV
- Export to Excel
- Printable view
- Copy to clipboard
If you are not aware about the PageBlockTableEnhancerADV or PageBlockTableEnhancer you can read about the same from the below links
List of 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 separated list of integer values that will displayed as dropdown for page size
- defaultPageSize : Default page size that needs to be selected (at page load).
- enableExport : Set this option to true to enable export toolbar (new in v2)
- exportFileName : Default filename to use when a user uses the export feature. (new in v2)
Syntax
<c:PageBlockTableEnhancerADV targetPbTableIds="mid,mid2" paginate="true" defaultPageSize="5" pageSizeOptions="5,10,20,30,40,50,100" enableExport="true" exportFileName="myFile"/>
Demo,Source And Installation Link : http://blogforce9dev-developer-edition.ap1.force.com/ProjectDetail?id=a0290000009M3zR
component is not working when sidebar is true and currency fields are not sorting.could you please look into it.I have installed from the above link in my dev org
ReplyDeleteYou probably have something in your sidebar, may be a jquery component, this works with sidebar on. I am looking into the currency sorting stuff
DeleteI just installed it and it is not working in IE 8.
DeleteI had a similar issue where I could not get the component to render consistently. I had been using it on both inline VF pages and full pages previously, but added it to a new page and it would not show up. Turns out that on my "full" VF pages with sidebar showing, I had another jQuery component interfering with the pageBlockTableEnhancer. I have not had time to modify any code but hiding the sidebar for these pages (and thus not calling any other jQuery components) worked for now.
DeleteI just installed and I'm experiencing a similar issue. When the sidebar is true it doesn't work. If sidebar is false it works well. This is true for both Chrome and Firefox, the only two I've checked so far.
DeleteI am having an issue with sorting a DateTime column. The PageBlockTable does not sort if the Dates are all the same. (It appears to ignore the Time portion of the DateTime.) If the dates are different, however, the sorting seems to work. Has anyone experienced this? Is there a fix for it?
ReplyDeleteWhich version you are using ? I will try to replicate the same and will let you know.
DeleteVery nice work. I found an issue with multiple tables for the export functionality. With more than one table the buttons do not work. It turns out that you can't do a mass initialization using $('Blog9ectc').datatable([parameters....}) but need to loop through and do them individually. It was easy to fix, I just added a counter and named each table by a different class name (classname + counter) and then looped through the tables and did a initialization or each on.. http://datatables.net/forums/discussion/3963/tabletools-on-multiple-tables/p1
ReplyDeleteI added a counter in two places and had it create a class for each table
Then did the intitialization in a foreach.
var targetIds = '{!targetPbTableIds}';
var targetIdArray = targetIds.split(",");
var i=0;// here is the counter
$(targetIdArray ).each(function(){
i=i+1;// here is the counter
var elem = this.trim();
var elemObj = $("[id$='"+elem+"']");
elemObj.addClass("BlogForce9TableADV"+i);//*each table got classed differently
});
i=0;
$(targetIdArray ).each(function(){
i=i+1;//here again
dataTable = $('.BlogForce9TableADV' + i).dataTable({ //Loop through
"bJQueryUI": true,
.....});
Thanks for all the great tools - hope this is usefull
Thanks nice catch!
DeleteI will be looking into and fixing it as soon as possible.
Quick Q : for whatever reason I get only 20 records displayed when there are many more than that. Pagination is on .
DeleteI am having an issue using the component and calling pageReference methods. In my instance, I am performing a custom search (to reduce the # of records returned) of Pricebook Entries, rendering a custom object instance of Pricebook Entry and some variables, then displaying them in a pageBlockTable. If the row is "Selected" (bheckbox), the commandButton calls a pageReference method, saving the records as QLI's. However, whenever the table is rendered using the component, the page simply refreshes with the pageRef methods not being called. If I hide the component, the pageRef method works fine. The pageRef saves the records and then redirects to another page.
ReplyDeleteAny thoughts on what might be causing this?
I haven't seen a issue like this, I will try the same in my org and will let you know
DeleteI have actually found this same issue on many actions, but seems inconsistent. I have tried save different variations of the page, but the only way to consistently execute the methods are by removing the component. I will keep working on it, as I really like this component and it's functionality is really what I want/need to finish off this process I'm working on. Please let know if I can provide any code samples that may help. Thanks.
DeleteThis comment has been removed by the author.
DeleteYou won't believe it! In my table, I had input fields to allow the user to specify quantity, sales price, etc. The pageBlockTable had originally been pulling in records from a custom class and I was using inputText for those fields. I then rebuilt it using custom fields on an actual custom OBJECT, had encountered the same issues but just continued to use the custom object to populate the table. After much troubleshooting, I flipped to inputFIELD as a last ditch effort and it worked! It shouldn't of made a difference, but it allowed me to finish up my page in just a few additional minutes. Quirky but I'm glad that it seems to be working! Thanks again for the wonderful VF component!!
DeleteThanks for the feedback, I will keep a note of this.
DeleteThis comment has been removed by the author.
ReplyDeleteHi Avinava,
ReplyDeleteI am using PageBlockTableEnhancerADV on my VF page. I do not want to display search box on pageblock header. Could you please suggest how I can remove or hide this?
Hope to see your response soon ! :)
- Pragya Tiwari
I think you can add style something like .dataTables_filter{display:none}
ReplyDeleteAvinava, this tool is great, exactly the functionality I was hunting for. Quick request, would it be possible to add a "New" button, to add a record into the data table? Thanks for your consideration.
ReplyDeleteHow to prevent sorting for a particular column?
ReplyDeleteExcellent work just one problem, it has sorting issues. It sorts by one or two colums in a Vf page. First we seem to think that sorting is fine but when we use it carefully it has problems with sorting. If we have 10 column it will sort them all but on basis of any two random colum in those 10 column.
ReplyDeleteGreat plugin, Helps alot.
ReplyDeleteOne thing i would like to share that is in Lightning Interface if you have more than 7,8 columns then the theme if this plugin works on first 6,7 columns. It works till there is search bar visible. After that the remaining columns work but they dont have the grey theme and bars aaround them.
Hi this is a great plugin but can it paginate records beyond the limit of vf pages which is 1000?
ReplyDeleteHi,
ReplyDeleteWhy does it restrict to show only 10 records even if we use a custom pagination and not standard setController. ?