sorting - Sort same value column by second column using Java Comparator -
i having trouble adding column on sorting have. have list , column info sort follow:
void sortresults(mytablemodel model, list<myresultdetail> list) { collections.sort(list, new beancomparator(model.getsort(), new comparator<comparable>() { @override public int compare(comparable o1, comparable o2) { if(o1 == null) { return -1; } else if(o2 == null) { return 1; } else if(o1.) else { return o1.compareto(o2); } } })); }
in above code using field name mytablemodel sort result. works fine if sorting on 1 column. trying add sorting based on 2 columns.
for example
class myresultdetail { private string firstcol; private string secondcol; private string thirdcol; ..... }
if user want sort secondcol
have sort equal secondcol
value firstcol
.
Comments
Post a Comment