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

options.sort not being populated on the third cycle of sorting

1 Answer 76 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 27 Feb 2012, 07:14 AM
When the grid is populated, the default sorting is taken from:
    serverPaging: true,
    serverSorting: true,
    sort: { field: "Name", dir: "asc" },
    serverFiltering: true,
    pageSize: 10
When I click the Name column header, the grid sorts in desc order as expected.
When I click for a second time, the options.sort array is not populated.
When I click for a third time, the grid sort in asc order.
It seems that for every second click the options.sort array is not being poulated.
Can this be resolved.

This is the code that I am using:

var investorDataSource = new kendo.data.DataSource({
                type: "json",
                transport: {
                    read: {
                        url: "http://localhost//XXXX?Name=^" + $("#searchfor").val(), 
                        dataType: "json"

                    },
                    parameterMap: function (options) {
                        return {
                            pageindex: options.page,
                            pagesize: options.take,
                            //orderby:options.sort[0].field
                            orderby: convertSort(options.sort)
                        }
                    }
                },
                schema: {
                    data: function (result) {
                        return result.Items || result;
                    },
                    total: function (result) {
                        //Note: this is != to the total no of records, but should work
                        return (result.PageSize * result.PageCount) || result.length || 0;
                    }
                },

                serverPaging: true,
                serverSorting: true,
                sort: { field: "Name", dir: "asc" },
                serverFiltering: true,
                pageSize: 10
            });

1 Answer, 1 is accepted

Sort by
0
Jeff
Top achievements
Rank 1
answered on 28 Feb 2012, 01:29 AM
Ignore this post.  Those wiser than me in the workings of Telerik controls say that this behaviour is by design.
Tags
Data Source
Asked by
Jeff
Top achievements
Rank 1
Answers by
Jeff
Top achievements
Rank 1
Share this question
or