2013-08-16 95 views
0

我正在使用YUI datatabale。我想对列进行排序。名称列工作正常,因为这是一个字符串。但列“ftrIdentifier”也将内容按字符串排序而不是数字。有人可以帮助我做到这一点。YUI DataTable自定义排序

function tableFeaturesWithCheckBoxes1() { 
    var myColumnDefs = [{ 
     key: "name", 
     label: commonMessages.featureTblHeading, 
     className: "tbldata", 
     minWidth: 80, 
     width: 90, 
     sortable: true 
    }, { 
     key: "ftrIdentifier", 
     sortColName: "ftrIdentifier", 
     label: "Id", 
     width: 50, 
     sortable: true 
    }]; 

    myDataSource = new YAHOO.util.DataSource(messages); 
    myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; 
    myDataSource.responseSchema = { 
     resultsList: "features", 
     fields: ["name", "ftrIdentifier"] 
    }; 

    var conf = { 
     height: "13.8em", 
     width: "45.2em" 
    }; 

    conf = localizeDataTableMsgs(conf); 
    dt = new YAHOO.widget.ScrollingDataTable("box1", myColumnDefs, 
     myDataSource, conf); 
} 

回答