0

I am using YUI datatabale. I want to sort columns. Name column is working fine as this is a string. But Column "ftrIdentifier" also sort the content as string not as number. Can someone help me on this.

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);
}
Samuel
  • 1,149
  • 8
  • 25
Abhinav Parashar
  • 619
  • 4
  • 11
  • 27

1 Answers1

0

You have to convert numeric data into actual numbers, not strings representing numbers, when you fetch them, then everything works just fine. DataSource does that for you:

http://developer.yahoo.com/yui/datasource/#parsers

user32225
  • 854
  • 7
  • 7