JSFiddle - React, Tailwind, and code Playground
by harifrais
HTML
<div id="example-table"></div>
JavaScript
var jsonres = [
{
"AGENCYID": "-1",
"TOTALREQUEST": 1,
"SelfID":5
},
{
"AGENCYID": "-1",
"TOTALREQUEST": 2,
"SelfID":9
},
{
"AGENCYID": "-1",
"TOTALREQUEST": 3,
"SelfID":25
}
];
var title = [];
var tabulatorCols = [];
$.each(jsonres, function(key, value){
$.each(value, function(key1, value1){
if ($.inArray(key1, title) != -1) {
} else {
tabulatorCols.push({"title" : key1, "field" : key1});
}
});
});
col = JSON.stringify(tabulatorCols);
console.log(col);
/*var table = new Tabulator("#example-table", {
data : jsonres,
columns: col,
});*/