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
partha_cegpartha_ceg 

Filtering Visualforce List alphabetically.

In a standard salesforce pages there is a way to filter/Sort the list based on staring Letter. This is precisely the requirement which was required to be built for custom visualforce page. I built a page and class which would do this functionality

 

click here to check the visualforce page and the controller to built the list

Abhi_TripathiAbhi_Tripathi
You can do this by using Set

//Set have contains that will check for *
yourSet.contains('*');

//then use logic to show them at the top or bottom of the list after sorting them

OR 
you can go for this post that sorts list using coparable interface
http://abhithetechknight.blogspot.in/2013/12/salesforce-comparable-interface-using.html

rangambrrangambr
Another way to sort is adding 'Order by' in your query where you get your 'Contacts' from the database. If you say 'select id, name from Contact order by Name' and add the returned rows to a list and use that list in your page it will be ordered as you wanted.

Ranga,