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

Grid, PageSize - Possible bug?

1 Answer 292 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel Botero Correa
Top achievements
Rank 1
Daniel Botero Correa asked on 29 Apr 2012, 07:48 AM
Hello,

I have an issue pretty weird with PageSize of Grid. When I set page size to 2 and I have more elements, in the pager, there is only one page instead of 3 or 4 but when I do sort or group, all pages in the pager appear.

I attach a video.

Am I doing something wrong?

This is the code Javascript:

$(document).ready(function() {
                     
                    var dataSource = new kendo.data.DataSource({
                        pageSize: 2,
                        transport: {
                                read:  "dataSourceJson.php"
                            },
                            schema: {
                                data: "data"
                            },
                            error: function(e) {
                                // handle event
                                alert("error");
                            },
                            change: function(e) {
                                // handle event
                                //alert("change");
                            }
                        });
                         
                        $("#grid").kendoGrid({
                            dataSource: dataSource,
                            pageable: true,
                            groupable: true,
                            scrollable: true,
                            sortable: true,
                            pageable: true
 
                        });
                         
                        $("#search").click(function() {
                            var Grid = $("#grid").data("kendoGrid");
                            var data = Grid.dataSource_data;
                            dataSource.read();
                        });
                });

This is the code of dataSourceJson.php:

<?php
 
$array = Array(Array("from_user" => "daniel","from_user_id" => "1"),
        Array("from_user" => "daniel","from_user_id" => "1"),
    Array("from_user" => "daniel","from_user_id" => "1"),
    Array("from_user" => "daniel","from_user_id" => "1"),
    Array("from_user" => "daniel","from_user_id" => "1"),
    Array("from_user" => "daniel","from_user_id" => "1"));
header('Content-Type: application/json; charset=iso-8859-1');
echo "{\"data\":" .json_encode($array). "}";
 
?>

Thank you,
Daniel

1 Answer, 1 is accepted

Sort by
0
Daniel Botero Correa
Top achievements
Rank 1
answered on 29 Apr 2012, 09:12 AM
Hello,

I solved my problem with this forum:

http://www.kendoui.com/forums/ui/grid/cannot-get-paging-to-work.aspx

This is the answer:

Hello Guy,

Could you please try to define the total function of the schema: total: "data.total" or check if the total number of records is returned by the service and pass it?
If that does not help, it would be best if you provide a sample runnable project or at least the Json response send back from the server.

All the best,
Alexander Valchev
the Telerik team

Regards,
Daniel Botero Correa
Tags
Grid
Asked by
Daniel Botero Correa
Top achievements
Rank 1
Answers by
Daniel Botero Correa
Top achievements
Rank 1
Share this question
or