This is a migrated thread and some comments may be shown as answers.

Kendo Grid not sorting

1 Answer 679 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Deej
Top achievements
Rank 1
Deej asked on 15 Oct 2013, 04:15 PM
I have a grid that's pulling data from an array, and it just won't sort when it loads up. I can sort it by clicking the column header, but I need it initially sorted. No matter what I try, it always comes up unsorted. The first few entries in the Count column are 100, 222, 11, 441, 168, 15, 493, 11, 32, 24...
$('#TopCalcsGrid').kendoGrid({
    dataSource: {
        data: topcalcs,
        schema: {
            model: {
                fields: {
                    Name: { type: "string" },
                    Count: { type: "number" }
                }
            }
        }
    },
    sortable: {
        allowUnsort: true
    },
    reorderable: true,
    resizable: true,
    columns: [{
        field: "Name",
        title: "Calculator"
    }, {
        field: "Count",
        title: "Count"
    }],
    sort: { field: "Count", dir: "desc" }
});

1 Answer, 1 is accepted

Sort by
0
Accepted
Deej
Top achievements
Rank 1
answered on 15 Oct 2013, 07:28 PM
Turns out sort is a property of DataSource, not KendoGrid. Put the sort property inside the dataSource block and it works.
Tags
General Discussions
Asked by
Deej
Top achievements
Rank 1
Answers by
Deej
Top achievements
Rank 1
Share this question
or