$(document).ready(function () {
var grid = $("#itemList").kendoGrid({
toolbar: kendo.template($("#template").html()),
columns: ["Manufacturer", "Model", "Price", "Tags"],
dataSource: {
transport: {
read: {
url: "catalogadmin/_index",
dataType: "json",
type: "POST",
data: {
filter: ""
}
},
},
schema: {
data: "data", // records are returned in the "data" field of the response
total: "total" // total number of records is in the "total" field of the response
},
pageSize: 2,
serverPaging: true
},
pageable: true
});
This correctly calls my datasource and passes in the filters etc, but the paging controls don't work. The paging controls appear but have no page numbers or totals. When I click on a next/prev page button, a JS error is thrown saying "Object does not support property or method 'slice'". If I remove the "pageable" option on the grid setup, I don't see any paging controls at all.
As far as I know, I'm correctly returning the total in the JSON result so that the grid knows the data source size:
{"total":4,"data":[data is in here and is all correct]}
Any ideas what could be going wrong here?
Thanks,
Charles
<path style="display: block; " d="M 21.748 348.065 A230 230 0 1,1 448.252 348.065 L 434.345 342.445 A215 215 0 1,0 35.655 342.445 z" stroke-linecap="square" stroke-linejoin="round" fill-opacity="1" stroke-opacity="1" fill="#d2d3d6" stroke="#9c9b9b"></path>
<div data-role="view" id="order_list_mobile" data-layout="mobile-tabstrip" data-title="<?php echo $this->language->get('text_sale');?>" data-reload="true" data-show="afterShow"> <header data-role="header"> <div data-role="navbar"> <a data-role="backbutton" data-align="left">Back</a> <span data-role="view-title"><?php echo $this->language->get('text_sale');?></span> </div> </header> <ul data-role="listview" data-style="inset" data-type="group" class="inboxList"> <li> <?php echo $this->language->get('text_sale');?> <ul> <?php if ($orders) { ?> <?php $id = 0;?> <?php foreach ($orders as $order) { ?> <li> <h3 class="time"><?php echo $order['customer']; ?></h3> <h3><?php echo $order['date_added']; ?></h3> <h3><?php echo $order['total']; ?></h3> <p><?php echo $order['date_added']; ?></p> <?php foreach ($order['action'] as $action) { ?> <a data-role="button" href="<?php echo $action['href'];?>"> <?php echo $action['text']; ?> </a> <?php } ?> </li> <?php } ?> <?php } ?> </ul> </li> </ul></div><script> function afterShow(e) { var tabstrip = e.view.footer.find(".km-tabstrip").data("kendoMobileTabStrip"); tabstrip.switchTo(2); }</script><div data-role="layout" data-id="mobile-tabstrip"> <header data-role="header"> <div data-role="navbar"> <a data-align="left" data-role="backbutton" class="nav-button"><?php echo $this->language->get('button_back');?></a> <span data-role="view-title"></span> <a data-align="right" data-role="button" class="nav-button" href="#index" data-icon="refresh"></a> </div> </header> <div data-role="footer"> <div data-role="tabstrip" id="myTabStrip"> <a href="#tabstrip-home" data-icon="recents"><?php echo $this->language->get('tab_general');?></a> <a href="#index.php?route=catalog/product&token=<?php echo $this->session->data['token'];?>" data-icon="cart"><?php echo $this->language->get('text_catalog');?></a> <a href="#index.php?route=sale/order&token=<?php echo $this->session->data['token'];?>" data-icon="bookmarks"><?php echo $this->language->get('text_sale');?></a> <a href="#tabstrip-settings" data-icon="settings"><?php echo $this->language->get('text_setting');?></a> </div> </div></div>