You need to sign in to do that
Don't have an account?
Carol Walgenwitt
Create Custom Controller Apex Class
I am following the exercise to Create Custom Controller Apex Class in Visualforce Basics - I created the class and page ContactsListWithController - I added all the required code - I have a problem with the new action method - At the end the instructions say "Although the visual appearance remains the same, if you click the First Name and Last Name column headers now, they will change the sort order for the contacts list. Nice!" I do not get First Name or Last Name columns to click - I only get Last Name and when I click nothing happens - I am attaching screenshots of my code - I do not understand what I did wrong. Please check my code so can figure this out. Thank you
Open your developer console and go to File > New > Visualforce Page. You will also need to replace the markups in the editor with the following bit of code:
<apex:page controller= »ContactsListController »>
<apex:form>
<apex:pageBlock title= »Contacts List » id= »contacts_list »>
<!– Contacts List goes here –>
</apex:pageBlock>
</apex:form>
</apex:page>
get more info on below salesforce link
https://trailhead.salesforce.com/content/learn/modules/visualforce_fundamentals/visualforce_custom_controllers
A custom controller is just an Apex class, which you write yourself using the Developer Console.
There are a lot of system and utility classes to help you write custom controller logic, but the only requirement for a class to be used as a custom controller is that it exists.
please go through this may be it will help you
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_custom.htm
and if you want to create the Sortable functionality by the click of First Name and Last Name then you can better understand from this :
https://help.salesforce.com/articleView?id=000328724&language=en_US&mode=1&type=1
if you have any query please comment.
---------------
If you find your Solution then mark this as the best answer to close this question.
Thank you!
Regards,
Suraj Tripathi