我正在使用Tabulator 4.1,我从ajax返回了json响应,因此我必须在tabulator中显示值。这里的问题是每次(即)每次更改的共存json数据
[{
"AGENCYID": "-1",
"TOTALREQUEST": 1
},
{
"AGENCYID": "-1",
"TOTALREQUEST": 2
}]
此处的键和值可能会增加。因此,根据需要在制表器中显示这些值,我尝试在制表器中动态设置标题和归档值,但没有任何效果。下面我附加了JS小提琴
答案 0 :(得分:0)
请修正您的Js小提琴网址
var jsonres = [
{
"AGENCYID": "-1",
"TOTALREQUEST": 1
},
{
"AGENCYID": "-1",
"TOTALREQUEST": 2
},
{
"AGENCYID": "-1",
"TOTALREQUEST": 3
}
];
var table = new Tabulator("#example-table", {
data: jsonres, //load row data from array
autoColumns: true
});
<!DOCTYPE html>
<html lang="en">
<script src="https://unpkg.com/tabulator-tables@4.2.4/dist/js/tabulator.min.js"></script>
<link href="https://unpkg.com/tabulator-tables@4.2.4/dist/css/tabulator.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<body>
<div id="example-table"></div>
</body>
</html>