As a Salesforce Developers we often get a requirement from clients to develop a visualforce page to search the records of a particular object.
e.g. Create a page which will accept search criteria’s and list the records which match the criteria. Since, Salesforce Reports often don't meet the requirements of the client, we end up creating a visualforce page.
These pages can be created using a plugin called “Dable”. This link will provide some good documentation, however I will list down some critical parts.
- Create a Visualforce page
- Referance it in your visualforce page
- Initialise “Dable”
- Thats it. Your table is now ready for sorting, searching and for paginations as well
How to use Dable?
Table can be built –
- Using the data
- Using an existing HTML table
1. Using the data
- Refer Dable script
- Define <div> where you want to generate your HTML table
- Provide Data in terms of Rows and Columns
- Initialise the Dable with div’s “Id
Once you have writen the above code, the following table will be generated. Most important step is to define a ‘div’ and passing its ‘Id’ to Dable script.
You can also provide “Bootstrap/jQuery/Custom Styles” to your table as per your needs.
2. Using an existing HTML table
Dable can be built on existing “HTML” table also. This is quite simple and easy to use. All you need to do is pass “div’s” id to dable script.
For faster results, you can call remote method from visualforce page to get list of records and pass it to dable as shown in method 1.
For documentation on Dable visit : http://deltreey.github.io/Dable/
Note: This plugin is used for sorting, searching and pagination on clients side, ie. on the browser, however if data is being modified in the backend, users may still see old values.