Salesforce 为什么visualforce表中选中的复选框高于未选中的复选框

Salesforce 为什么visualforce表中选中的复选框高于未选中的复选框,salesforce,visualforce,apex,Salesforce,Visualforce,Apex,I按字段订单号对表格排序的内容: 我有一个WrapperClass,它实现了以下接口: public class CheckListWrapper implements Comparable { public Boolean isChecked {get; set;} public String shortDescription {get; set;} public String fullDescription {get; set;} public Integer

I按字段订单号对表格排序的内容:

我有一个WrapperClass,它实现了以下接口:

public class CheckListWrapper implements Comparable
{
    public Boolean isChecked {get; set;}
    public String shortDescription {get; set;}
    public String fullDescription {get; set;}
    public Integer order {get; set;}
    public CheckList__c checkList;
    public CheckListItem__c checkListItem;

    public CheckListWrapper(CheckList__c chList)
    {
        shortDescription = chList.Short_Description__c;
        fullDescription = chList.Full_Description__c;
        order = (Integer)chList.Order__c;
        isChecked = false;
        checkList = chList;
    }

    public CheckListWrapper(CheckListItem__c chListItem)
    {
        shortDescription = chListItem.CheckList__r.Short_Description__c;
        fullDescription = chListItem.CheckList__r.Full_Description__c;
        order = (Integer)chListItem.CheckList__r.Order__c;
        isChecked = true;
        checkListItem = chListItem;
    }

    public Integer compareTo(Object compareTo)
    {
        CheckListWrapper compareToCheckList = (CheckListWrapper)compareTo;
        Integer returnValue = 0;
        if (checkList != null)
        {
            if (checkList.Order__c > compareToCheckList.checkList.Order__c)
            {
                returnValue = 1;
            } else if (checkList.Order__c < compareToCheckList.checkList.Order__c)
            {
                returnValue = -1;
            }
        } else if (checkListItem != null)
        {
            if (checkListItem.CheckList__r.Order__c > compareToCheckList.checkListItem.CheckList__r.Order__c)
            {
                returnValue = 1;
            } else if (checkListItem.CheckList__r.Order__c < compareToCheckList.checkListItem.CheckList__r.Order__c)
            {
                returnValue = -1;
            }
        }

        return returnValue;
    }
}
公共类CheckListWrapper实现了可比较的
{
公共布尔值已检查{get;set;}
公共字符串shortDescription{get;set;}
公共字符串fullDescription{get;set;}
公共整数顺序{get;set;}
公共检查表(c)检查表;;
公共CheckListItem\uuu\c CheckListItem;
公共检查列表包装器(检查列表)
{
shortDescription=chList.Short\u Description\u\c;
fullDescription=chList.Full\u Description\c;
order=(整数)chList.order\uu c;
isChecked=false;
检查表=chList;
}
公共CheckListWrapper(CheckListItem\uuu\c chListItem)
{
shortDescription=chListItem.CheckList\uu r.Short\u Description\uu c;
fullDescription=chListItem.CheckList\uu r.fullDescription\uu c;
顺序=(整数)chListItem.CheckList\uu r.order\uu c;
isChecked=true;
checkListItem=chListItem;
}
公共整数比较对象(对象比较对象)
{
CheckListWrapper CompareTochellet=(CheckListWrapper)compareTo;
整数值=0;
如果(检查表!=null)
{
如果(检查表.顺序\uuuu c>比较检查表.检查表.顺序\uu c)
{
返回值=1;
}否则,如果(检查表.顺序检查c<比较检查表.检查表.顺序检查c)
{
返回值=-1;
}
}else if(checkListItem!=null)
{
如果(checkListItem.CheckList\u r.Order\u\c>比较CheckList.checkListItem.CheckList\u r.Order\u\c)
{
返回值=1;
}否则如果(checkListItem.checkListItem.checkListItem.checkListItem.checkListItem.checklistOrder)
{
返回值=-1;
}
}
返回值;
}
}
界面可比较,但所有选中的复选框都高于未选中的复选框。
问题是为什么选中的复选框高于未选中的复选框,以及如何避免它。我理解我的错误:一切正常,但我应该在方法compareTo中使用一个块if-else,而不是通过对象检查表引用字段顺序。我应该使用CheckListWrapper中的“order”变量:

public Integer compareTo(Object compareTo)
    {
        CheckListWrapper compareToCheckList = (CheckListWrapper)compareTo;
        Integer returnValue = 0;
        if (order > compareToCheckList.order)
        {
            returnValue = 1;
        } else if (order < compareToCheckList.order)
        {
            returnValue = -1;
        }

        return returnValue;
    }
public Integer compareTo(对象compareTo)
{
CheckListWrapper CompareTochellet=(CheckListWrapper)compareTo;
整数值=0;
如果(顺序>比较清单顺序)
{
返回值=1;
}否则,如果(订单<比较清单.订单)
{
返回值=-1;
}
返回值;
}