You need to sign in to do that
Don't have an account?

Sorting NULL fields on Visualforce Page using Comparable Interface
Hello,
I have implemented Custom Sorting on a VF page using Comparable Interface. If there are 10 records in a Page and few of the fields on the records are NULL then the List.Sort method is not functioning properly when there are NULL and NOT NULL fields included. Please suggest.
Thanks
if (SortDirection == 'Ascending')
// Check if account type is not Null, if its Null return -1
return this.account.Type != Null ? this.account.Type.compareTo(otherType) : -1;
// For Descending
else
// Check if account type is not Null, if its Null return 1
return this.account.Type != Null ? otherType.compareTo(this.account.Type) : 1;
http://cloudfollowsdotcom.wordpress.com/2012/12/27/sorting-in-visualforce-using-comparable-interface/
Or
Integer otherVoteNum = other != null ?
http://www.sharealltech.com/articles/2-how-to-use-apex-comparable-interface-sorting-complex-data
Also See,
http://gaganbansalblog4u.com/2013/02/28/pagination-in-visualforce-page-along-with-sorting/
http://www.infallibletechie.com/2013/08/how-to-check-whether-string-is-null-or.html
Regards,
Ashish