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
westjohnwestjohn 

Data Tables in salesforce?

Any one using data Tables(http://datatables.net/) in Standard Set controller? 

Best Answer chosen by Admin (Salesforce Developers) 
JitendraJitendra

Hi,

 

What problem you are facing here?

  • Import the required library as a static resource.
  • Render your data using <apex:repeater> in Visualforce with a ID.
  • At the end of <apex:page> tag enter below JQuery / Javascript code.
$(document).ready(function(){
	$('#ID_Of_Repeater').dataTable();
});

 

 

You should look on this example:

 

http://live.datatables.net/#javascript,html

All Answers

JitendraJitendra

Hi,

 

What problem you are facing here?

  • Import the required library as a static resource.
  • Render your data using <apex:repeater> in Visualforce with a ID.
  • At the end of <apex:page> tag enter below JQuery / Javascript code.
$(document).ready(function(){
	$('#ID_Of_Repeater').dataTable();
});

 

 

You should look on this example:

 

http://live.datatables.net/#javascript,html

This was selected as the best answer
westjohnwestjohn

Thanks Jitendra..

 

I am using 'Scroller example - 50'000 rows' in My page....

Link is http://datatables.net/release-datatables/extras/Scroller/large_js_source.html

 

I have 4000 records in Account Object... I set page size is 2000 in My page... Problem is I show all records in same page(as per scroller example).. But Standard set Controller takes only first 2000 records...How to get my remaining records and show in my page?

 

My apex Code:


Accounts = new ApexPages.StandardSetController(Database.getQueryLocator([ SELECT Id,
Name,LastActivityDate
]));
Accounts.setPageSize(2000);
AccountList = (List<Account>)Accounts.getRecords();

 

In data tables takes only Standard set Controller query Values...Can u possible to pass normal List Values to page?


JitendraJitendra

Hi,

 

For this you will need to implement pagination at server side. Please have a look at below URL :

http://datatables.net/release-datatables/extras/Scroller/server-side_processing.html

 

For above example, the JSON used by them are : http://datatables.net/release-datatables/extras/Scroller/media/data/server_processing.php

 

create a VF page with response type as "JSON". And implement the pagination logic in that VF page.


 

for pagination , you can use few below links:

http://boards.developerforce.com/t5/General-Development/How-to-implement-Pagination-With-Salesforce-Native-Look-And-Feel/td-p/269235

 

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

 

OR

 

simply you can wrap the object with counter starting from 1 and as per page parameter display the wrapper class in JSON.

 

If you want to know how to create a JOSN page then visit belwo Link:
http://shivasoft.in/blog/salesforce/json-output-in-visualforce/ 

 

westjohnwestjohn

Thanks Jitendra..

I am also tried serverside for getting data..... In also serverside takes only 2000 records not all records... i want to know how to get all data without pagination in standard set controller?