Kendo UI Grid - serverside pagination with PHP

Can anyone assist in getting my Grid working so that it pulls and displays 50 rows at a time? It currently displays 50 rows but does not show any page numbering. I have included a total of 120 in the datasource but do not know where to go from here. How do I display the page numbers and pass $start, $limit variables to my query is is getting the data?

Where it should say "1 - 50 of 120 items" it says "No items to display"

Im stuck. :0(

var mydata =  {"data":[

        <?php foreach ($data_arr as $data){ ?>
            { "id": "<?php echo $data['id']; ?>",  "name":"<?php echo $data['surname'] . ', ' . $data['firstname']; ?>",  "company": "<?php echo $data['company']; ?>",   "Email": "<?php echo $data['email']; ?>"},
        <?php 
        }
        ?>
        ]       , "total": <?=$total?>};
>       
>       
>         $("#grid").kendoGrid({
>             dataSource: {
>                 data: mydata.data,
>                 schema: {
>                   total: "total",
>                     model: {
>                         fields: {
>                             id: { type: "number" },
>                             name: { type: "string" },
>                             company: { type: "string" },
>                             email: { type: "email" }
>                         }
>                     }
>                 },
>                 pageSize: 50
>             },            serverPaging: true,
>             scrollable: false,
>             sortable: true,
>             filterable: true,             selectable: "row",
>           detailTemplate: kendo.template($("#detailTemplate").html()),
>             detailInit: detailInit,
>             pageable: {refresh: true,},           
>             columns: [
>                 {field:"id",title: "ID",filterable: false},
>                 {field: "name",title: "Name"}, 
>                 {field: "company",title: "Company"}, 
>                 {field: "email",title: "Email"}             
>             ]                 
>         });

Then there's the server side PHP which does not seem to be getting anything from the URL all :

//get current page from URL $get = $_SERVER['REQUEST_URI']; parse_str($get); if(isset($page)){ $start = $page;

$limit = $pagesize; } $admin = new Admin();

$count_data = $admin->countRows(); //brings back 120 $mydata= $admin->getRows($start=0,$limit=50);

Answers


The grid's data source isn't configured for server binding. You must configure the transport.read option to provide the url which will return the paged data. The data source will post the page and pagesize.

Here is an online demo you can check: http://demos.kendoui.com/web/grid/remote-data.html


Try this to get variables from the url:

$start = $_GET['page'];
$limit = $_GET['pagesize'];

That should work


Need Your Help

Factory object or Product object

design-patterns design object factory

I am learning more about the factory design pattern and came across the following example from Microsoft (I recoded it in java). Example here

Deployments to Azure Websites can take hours to go live

azure visual-studio-2012 azure-web-sites azure-deployment azure-git-deployment

I've just started to use Azure Websites to host one of the websites I'm working on. Everything has been very smooth so far, but what I've realized is that when we update our website, sometimes that

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.