Reputation: 502
I want the server side paging in kendo ui using php.So anybody know how to do that? I have do like serverpaging=true in grid.And for server side logic i need the which page number is selected so i can calculate like pagenumber*perpage and get that records by query. But how to pass that selected page number to server side?
var crudServiceBaseUrl = "<?=base_url()?>",
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl+"did_grid_list",
type:"GET",
dataType: "jsonp"
},
serverPaging: true,
pageSize: 20,
schema: {
total: function(data) { console.log(10034); return 10034; },
model: {
id: "id",
fields: {
did: { validation: { required: true,max:9 } },
}
}
}
});
above code is my view file.COntroller side is like
$json_data = array();
$count_all = count($this->dids_model->did_get($action));
$page_no = $_GET['page'];
$json_data['page'] = $page_no;
$json_data['total'] = ($count_all>0) ? $count_all : 0;
$perpage = 20;
$start = ($page_no-1) * $perpage;
if($start < 0 )
$start = 0;
$result = $this->dids_model->did_get($action,$start,$perpage);
Upvotes: 0
Views: 1474
Reputation: 40887
Please, take a look into serverPaging
documentation. It shows you the parameters that you will receive in your request referring to:
take
: contains the number of records to retreiveskip
: how many records from the front of the dataset to begin readingpage
: the index of the current page of datapageSize
: the number of records per pageUpvotes: 1