【发布时间】:2018-10-05 00:19:27
【问题描述】:
我正在使用 Tabulator 插件在 jsp 页面内为我处理表格和排序。当我在标签内使用数据表时,它工作正常。我现在正试图从我们使用的系统返回 AJAX 数据。下面是系统返回的json示例。
如何配置 Tabulator 以使用数据并跳过响应的“平台”部分?
JSP 脚本 表
<script>
//Build Tabulator
var table = new Tabulator("#example-table", {
height:"311px",
layout:"fitColumns",
placeholder:"No Data Set",
columns:[
{title:"PO", field:"po_number", sorter:"string", width:200},
],
});
//trigger AJAX load on "Load Data via AJAX" button click
$("#ajax-trigger").click(function(){
table.setData("https://mysystem.com/record/fieldList=po_number&alt=json");
});
</script>
JSON 响应:
{“平台”:{ “信息”: { “代码”:“0”, “描述”:“成功” }, “记录”: [ {"po_number": "P000466"}, {"po_number": "P000791"}, ], “记录数”:“2” }}
【问题讨论】:
标签: jquery json ajax tabulator