它确实与pagination: "remote"
.net 一起使用,但 ** 出于某种原因,我们必须在 .net 中使用自定义 ajax 函数 ** 但不是ajaxURL
选项。
这是功能要求吗?提前感谢您的帮助。
以下是以下代码:
- 分页:带有自定义ajax的“远程”(有效)
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<link href="https://unpkg.com/tabulator-tables@4.1.2/dist/css/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.1.2/dist/js/tabulator.min.js"></script>
<script>
function queryRealm(url, config, params) {
return new Promise(function (resolve, reject) {
$.ajax({
url: 'data.php',
success: function(data){
resolve(JSON.parse(data));
},
error: function(error){
reject(error);
}
})
});
}
var table = new Tabulator("#example-table", {
ajaxRequestFunc: queryRealm,
pagination: 'remote',
columns: [{
title: "id",
field: "id",
},
{
title: "Name",
field: "name",
width: 200
}
],
height: "292px",
});
- ajaxProgressiveLoad:使用自定义 ajax 进行“滚动”(不起作用)
只需更改pagination: 'remote',
为ajaxProgressiveLoad: "scroll"
data.php 如下:
$data = [
["id"=>1, "name"=>"Billy Bob============"],
["id"=>2, "name"=>"Mary May"],
["id"=>3, "name"=>"Christine Lobowski"],
["id"=>4, "name"=>"Brendon Philips"],
["id"=>5, "name"=>"Margret Marmajuke"],
["id"=>6, "name"=>"Christine Lobowski"],
["id"=>7, "name"=>"Brendon Philips"],`enter code here`
["id"=>8, "name"=>"Margret Marmajuke"],
["id"=>9, "name"=>"Margret Marmajuke"],
];
echo(json_encode(["last_page"=>10, "data"=>$data]));
更新了图像 启用 ajaxUrl 选项