Hi.
I make kendo grid which has pageable: {pageSizes: true, pageSize: 10} options.
After $("#grid").data("kendoGrid").setDataSource(dataSource), pageSize is changed NaN.
even setOptions() is not working.
$("#grid").data("kendoGrid").setOptions({
pageable: {
pageSizes: true,
pageSize: 10,
}
});
This is sample code.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Kendo UI Snippet</title>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2020.2.617/styles/kendo.default-v2.min.css"/>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2020.2.617/js/kendo.all.min.js"></script>
</head>
<body>
<div id="grid"></div>
<script>
let dataSource =new kendo.data.DataSource({data:[{ productName: "Tea", category: "Beverages" }]});
$("#grid").kendoGrid({
columns: [
{ field: "productName" },
{ field: "category" }
],
dataSource: [
{ productName: "Tea", category: "Beverages" },
{ productName: "Coffee", category: "Beverages" },
{ productName: "Ham", category: "Food" },
{ productName: "Bread", category: "Food" }
],
pageable: {
pageSizes: true,
pageSize: 10,
},
});
$("#grid").data("kendoGrid").setDataSource(dataSource);
$("#grid").data("kendoGrid").setOptions({
pageable: {
pageSizes: true,
pageSize: 10,
}
});
</script>
</body>
</html>