Build a Dropdown list from column Header
Build a Dropdown list from column Header
I am building a custom search tool that requires a drop down list derived from the visible Column Headers. the data is com,in from the server so i am using sName. I ran a test to see what lives inside the aoColumns.
var table = $('#mytable').DataTable();
'var columns = table.context[0].aoColumns;
var columnslen = table.context[0].aoColumns.length;
console.dir(table.context[0])
for (var i = 0; i < columnslen; i++) {
console.log(columns[i].sName + ' : '+ columns[i].bVisible );
}
has anyone done this. and have a suggestion
Replies
[Resolved]
Can you please share how you are able to do it?
I am still working on this but this should give you an idea.
sample
...
"aoColumnDefs": [
{ "aTargets": [0], "bVisible": true, "bSearchable": true, "sName": "First_Name", "name": "First Name" },
...