Has anyone ever tried to replicate the alphabet sorting functionality you see in the list views? Any ideas on how to achieve this?
|
|
This functionality already exists on
|
|||
|
|
|
I think you're asking about how best to replicate the table sorting that happens when the user clicks a column header. If that's the case, you have basically two sorting options and three client-side table rendering options. Sorting: client-side or server-side. I'd opt for client-side if your total record set is small, as this is MUCH faster to the end user. Use server-side sorting if your record set is large, or if you need some very complex sorting logic that would be unwieldy in Javascript (extremely unlikely). If you do opt for server-side sorting, be aware that the default alphabetic sorting for Apex strings is case-sensitive; you'll have to work around this in your code, usually by implementing your own sort logic. Table rendering: either use a standard VisualForce table control (i.e. DataTable) with sorting actions on the column headers (example here), or build your own HTML table (I would not recommend this but it's common), or use an off-the-shelf Javascript/HTML library. In my experience, the ExtJS library is incredibly full-featured for many things like this, including building data tables that have lots of fancy user-side features including sorting and row highlighting, but it's not free. (It's also used extensively by Salesforce within their products). There are plenty of free options based on (among other libraries) jQuery, including this datatables plugin. |
|||
|
|