Skip to main content

HI , I want to have alphabetical sorting on my page to extract the records by the start of its letter like we have in standard salesforce page like a, b c, d…plz suggest

Hi,

You can make a condition in the model like Name starts with ‘’ Filterable.

And make buttons or a filter in a table to set and apply the condition with each letter


Can you please explain the second part of your answer. I mean would be helpful if you provide an example.

Thanks in advance


You can do a lot of things, this are examples (quick thought):

1.- buttons:

Create buttons for each letter with a redirect to your page adding the “nameofthefilter=a”, “nameofthefilter=b” …


for example: (assuming the page is called ‘ListPage’ filter is called ‘namestartswith’) the url will be something like ‘/apex/ui?page=ListPage&namestartswith=a’


this will refresh the page and set and activate the condition ‘namestartswith’ with the letter a.


2.- template.

you can do the same in a template. Cons: a lot of manual html code. Pros: easily to apply styles. the template will be something like ‘AB …’


3.- filter in the table.

Create a filter in a table with all the options and set and activate the condition.

Pros: refresh only the table, not the page. Cons: it’s a table filter it will be shown as a select box in the table (not like an index)


4.- filter in a table with an aggregate model.


  • Create a formula field in your object to get the initial.

  • Use this field in a aggregate model of your object to get all the initials (group by this field)

  • create a filter in the table to set and activate the condiiton.

  • configure the filter to get all the options from the rows of the aggregate model.

Pros: same as point 3 and you don’t have to write all the letters, and if there is no record with the initial M, the M letter will not be shown.


Cons: same as point 3 and if there is no record with the initial M, the M letter will not be shown. (maybe you don’t desire this behaviour)


5;- create a component (javascript involved)


Thanks Pablo for your reply…will try it out and will let you know.


Thanks Pablo. 🙂


Yes!  Thanks Pablo.  You’ve gone far above and beyond what I was thinking.  I was going to stop at idea #3