Tabulator filter columns

by harifrais

HTML

<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/js/tabulator.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/css/tabulator.min.css">
<div id="example-table"></div>

JavaScript

var jsonres = [
	{
		"AGENCYID": "-1",
		"TOTALREQUEST": 1
	},
	{
		"AGENCYID": "-1",
		"TOTALREQUEST": 2
	},
	{
		"AGENCYID": "-1",
		"TOTALREQUEST": 3
	}
];
var tabulatorCols = [];
var tabulatorData = [];
$.each(jsonres, function(key, value){		
			$.each(value, function(key, value){
				//console.log(key, value);
				tabulatorCols.push(key);
				tabulatorData.push(value);
			});
	});
	console.log('**Columns**'+tabulatorCols);		
	console.log('**TableData**'+tabulatorData); 




var tableData = [
    {id:1, name:"Billy Bob", age:"12", gender:"male", height:1, col:"red", dob:"", cheese:1},
    {id:2, name:"Mary May", age:"1", gender:"female", height:2, col:"blue", dob:"14/05/1982", cheese:true},
]

colval = [
        {title:"Name", field:"name"},
        {title:"Age", field:"age"},
        {title:"Gender", field:"gender"},
        {title:"Height", field:"height"},
        {title:"Favourite Color", field:"col"},
        {title:"Date Of Birth", field:"dob"},
        {title:"Cheese Preference", field:"cheese"},
    ];

var table = new Tabulator("#example-table", {
    data:tableData, //set initial table data
    columns:colval,
});