+ Start a Discussion

Comparable interface problem

hi to all,
Here i am facing the problem.
here i written some piece of code for sorting account name or account annual revenue like that.
Here i  written some piece of code.  i am unable to solve the solution.
So please help me.
public class ComparableAccountNames_controller {
   public list<WrapperClass> wraperlist{get; set;}
   public list<account> actlist {get; set;}
   public ComparableAccountNames_controller(){
       actlist = [select id, name, phone from account limit 10];
   public class WrapperClass implements comparable {
       public string actlist.name {get; set;}
       public integer actlist.phone {get; set;}
       public WrapperClass( actlist.name, actlist.phone){
       this.actlist.name = actlist.name;
       this.actlist.phone = actlist.phone;
         global Integer compareTo(Object ObjToCompare) {
             return actlist.Name.CompareTo(((WrapperClass)ObjToCompare).actlist.Name);

Thanks in advance 
Amit Chaudhary 8Amit Chaudhary 8
Please check below post for Wrapper sorting that will help you
1) http://amitsalesforce.blogspot.in/2014/11/pagination-with-wrapper-class-with.html

Please let us know if this will help you

Amit Chaudhary
Hi Amit,
Here i want to sort the columns like account number or  annual revenue.
 I want to implement the Comaprable interface.
Please help me .