I have a api from a store. I take back with json request a structure like this 3 records in first level
data, error_no, msg
In second level inside data have
data.items, data.total_pages, data.total_results
Inside data.items (3 level) have the records who i need load to tabulator table. So this nested records i need extract and load items only to table ? How can select them ?
function loadTableTab(tableData) {
var table = new Tabulator("#table", {
data:tableData, //set initial table data
columns:[
{title:"product_title", field:"product_title"},
{title:"sale_price", field:"sale_price"},
],
});
}
You can use the ajaxResponse callback to format the data in a way that Tabulator can handle, it is passed in the response and should return the array of table data, so in your case it should be:
function loadTableTab(tableData) {
var table = new Tabulator("#table", {
data:tableData, //set initial table data
ajaxResponse:function(url, params, response){
return response.data.items; // return the array of table items
},
columns:[
{title:"product_title", field:"product_title"},
{title:"sale_price", field:"sale_price"},
],
});
}