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);
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 retreive skip
: how many records from the front of the dataset to begin reading page
: the index of the current page of data pageSize
: the number of records per page
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.