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

Grid custom read function paging options null

3 Answers 414 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 18 Mar 2015, 06:18 PM
I am trying to do my own custom paging on the server but on initial load by calling grid.datasource.read() the options.data.skip and take  parameters are null

$scope.searchGridOptions = {
            dataSource: new kendo.data.DataSource({
                type: "ajax",
                transport: {
                    read: function (options) {
                        $scope.FilterMeta.QueryFilterSearchViewModel.StartIndex = options.data.skip ? options.data.skip : 0;
                        $scope.FilterMeta.QueryFilterSearchViewModel.DisplayLength = options.data.take ? options.data.take : 10;
                        var js = JSON.stringify(createSearchRequestData($scope.FilterMeta));
                        //e.data.push({ queryFilterSearchViewItem: js })
                        $.ajax({ method: 'POST', url: 'http://localhost:6661/api/Schools/GetEntitiesForSearch', data: { queryFilterSearchViewItem: js } })
                            .success(function (data) {
                                return options.success(data);
                            }).error(function (error) {
                                options.error(error);
                            });
 
                    }
                },
                schema: {
                    data: function (data) {
                        return data.Results;
                    }, // records are returned in the "data" field of the response
                    total: function (data) {
                        return data.TotalEntityCount;
                    }
                },
                serverFiltering: true,
                serverSorting: true,
                pagesize: 10,
                serverPaging: true
            }),
            error: function (e) {
                if (e.errors) {
                    alert(e.errors);
                }
            },
            sortable: true,
            pageable: true,
            scrollable: false,
            autoBind: false,
            columns: $scope.searchGridColumns
        };

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 20 Mar 2015, 02:21 PM
Hello Jason,

The ajax type that you are trying to use is not a built-in one and we are not aware of it. For the initial request you should get the initial page parameters page, and take. Here is an example:

http://dojo.telerik.com/@pesho/Osira

Could you please point us what exactly is your case and if possible demonstrate it through a small sample.

Thank you for the cooperation.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Mariappan
Top achievements
Rank 1
answered on 15 Feb 2016, 02:12 PM

hi,

I'm also facing the same problem.

When i'm running my application in IE11 i'm facing this issue. I've kept the 'alert('the parameters are :' + JSON.stringify(options.data))' and verified. Below is the output of that alert.

the parameters are :{"take":"0","skip":null,"page":null,"pageSize":"0"}

But when i run the same application on IE9, every thing is working fine as expected. skip: 0 and page:1

 

Can you kindly help us out - whether the issue is because of IE11??

0
Rosen
Telerik team
answered on 18 Feb 2016, 06:46 AM

Hello Mariappan,

Could you please provide a bit more details about the implementation of the transport as well as the DataSource configuration and usage. A small runnable sample demonstrating the issue will be appreciated.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Mariappan
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or