0
votes

I want decimal column sorting in kendo ui grid. In the Above screen shot I need Salary column(Decimal values - values are bind in json string) sorting in either ascending or descending. I need this option in MVVM model. No need in MVC Architecture (No need c# code) Any one can help me please. Am new of this field. enter image description here

1

1 Answers

0
votes

Try defining salary as number in you DataSource.model.

Ex: Instead of defining the model as (or not defining it):

schema  : {
    model: {
        fields: {
            Id       : { type: 'number' },
            Name:    : { type: 'string' },
            Salary   : { type: 'string' },
            ...
        }
    }
}

Define it as:

schema  : {
    model: {
        fields: {
            Id       : { type: 'number' },
            Name:    : { type: 'string' },
            Salary   : { type: 'string' },
            ...
        }
    }
}

Check the two grids in the following example (http://jsfiddle.net/OnaBai/H4U7D/), the first defines Salary as string while the second defines it as number. The second grid correctly sorts the data.