Tabulator Pagesize
SetPageSize and rendering data
by harifrais
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/3.5.3/css/tabulator.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tabulator/3.5.3/js/tabulator.min.js"></script>
<select id="pagesize">
<option value="2">2</option>
<option value="4">4</option>
<option value="6">6</option>
<option value="8">8</option>
</select>
<div id="example-table"></div>
JavaScript
//define some sample data
var tabledata = [
{id:1, name:"Oli Bob", age:"12", col:"red", dob:"14/05/1982"},
{id:2, name:"Mary May", age:"1", col:"blue", dob:"14/05/1982"},
{id:3, name:"Christine Lobowski", age:"42", col:"green", dob:"22/05/1982"},
{id:4, name:"Brendon Philips", age:"125", col:"orange", dob:"01/08/1980"},
{id:5, name:"Margret Marmajuke", age:"16", col:"yellow", dob:"31/01/1999"},
{id:1, name:"Oli Bob", age:"12", col:"red", dob:"14/05/1982"},
{id:2, name:"Mary May", age:"1", col:"blue", dob:"14/05/1982"},
{id:3, name:"Christine Lobowski", age:"42", col:"green", dob:"22/05/1982"},
{id:4, name:"Brendon Philips", age:"125", col:"orange", dob:"01/08/1980"},
{id:5, name:"Margret Marmajuke", age:"16", col:"yellow", dob:"31/01/1999"},
];
$("#example-table").tabulator({
layout:"fitColumns",
tooltips:true,
addRowPos:"top",
history:true,
pagination:"local",
paginationSize:10,
movableColumns:true,
resizableRows:true,
responsiveLayout:true,
columns:[ //Define Table Columns
{title:"Name", field:"name", width:150},
{title:"Age", field:"age", align:"left", formatter:"progress"},
{title:"Favourite Color", field:"col"},
{title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
]
});
$("#example-table").tabulator("setData", tabledata);
//load sample data into the table
//table.setData(tabledata);
$("#pagesize").on("change", function(){
$("#example-table").tabulator("setPageSize", $(this).val());
// table.setPageSize($(this).val());
});