So my friend found the solution:
In the collectionBean :
private Comparator<String> vNoComparator = new Comparator<String>(){
public int compare(String iRec1, String iRec2){
if(iRec1==null || iRec2==null)
{
if(iRec1==null && iRec2==null)
return 0;
if(iRec1==null)
return -1;
return 1;
}
long vNumber1= Long.parseLong(iRec1) ;
long vNumber2= Long.parseLong(iRec2);
if(vNumber1>vNumber2)
return 1;
else if(vNumber1<vNumber2)
return -1;
else
return 0;
}
};
比较法的类型是按我们分类的属性类型,在这种情况下是记录。 无
public Comparator<String> getvNoComparator() {
return vNoComparator;
}
public void setvNoComparator(Comparator<String> vNoComparator) {
this.vNoComparator = vNoComparator;
}
In .xhtml
<ace:dataTable
value="#{eITDocumentsCollectionBean.AEITDocumentsItems}"
var="eITDocumentsItemBean" …..
<ace:column
headerText="#{eITDocumentsCollectionBean.ARecordNumberColumnName}"
sortBy="#{eITDocumentsItemBean.ARecordNo}"
sortFunction="#{eITDocumentsCollectionBean.vNoComparator}">
ARecordNo= the attribute in the ItemBean to sort by it
vNoComparator= the Comparator I create