2013-08-16 96 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); 
} 

回答