Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Kendo Grid display items issue

$
0
0

Hi All,

 In my grid, I have the following script

 
myGridData.ds = new kendo.data.DataSource({
               transport: {
                read: function(options) {
                    var myData = [];
                    var myGrid = $("#grid").data("kendoGrid");
                    var pageSize = myGrid.dataSource.pageSize();
                    var currentPage = myGrid.dataSource.page();

                    var totalRtn = 0;

                    CallController(false, '/main/LoadData?from=' + $("#dateFrom").val() + '&to=' + $("#dateTo").val() + '&pageNumber=' + currentPage + '&pageSize=' + gridPageSize,
                        function(result) {
                            for (var i = 0; i < result.length; i++) {
                                        ...other code goes here...
                                    };

                                    totalRtn= result.length
                                };
                            };
                        });

                    options.success(myData);
                }
            },
            serverPaging: true,
            schema: {
                model: {
                    id: "Id",
                    fields: {
                        ...fields info goes here...
                    }
                },

                 total: "totalRtn" // using this will give to "No items to display" and removing it will give me the attach screen shot.
            },
            pageSize: 500    //initial setting 
        });

 var grid = $("#grid").kendoGrid({
            dataSource: myGridData.ds,
            scrollable: true,
            columnMenu: true,
            groupable: true,
            sortable: true,
            resizable: true,
            reorderable: true,
            filterable: true,
            pageable: {
                refresh: true,
                buttonCount: 5,
                pageSizes: [200, 500, 1000, 5000, 10000]
            },
            columns: [
            {
                field: 'xxxx',
                title: 'yyyy',
            }, etc...

            ]

The problem that I'm facing is whenever I changed the 'items to page' to display; the total items is the same as my pageSize.  If I hard code the pageSize to max value (10000) it will be fine, but wouldn't that beat the purpose of having the serverPaging set to true.  Any help is appreciated or provide some explanation of how I could achieve this issue?

TIA


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>