Datatables .columnfilter() dynamic lists
Datatables .columnfilter() dynamic lists
Maybe I missed this somewhere, and I apologize if I did, but when using the .columnfilter, is it possible to build a dynamic list from an already populated column?
If I have a column called timezone, which could be any number of zones, can the dropdown only show the zones that are in the current list?
This was taken from the example I found:
[code]
$('#example').dataTable()
.columnFilter({
aoColumns: [ { type: "select", values: [ (POPULATED FROM COLUMN) ] },
[/code]
If I have a column called timezone, which could be any number of zones, can the dropdown only show the zones that are in the current list?
This was taken from the example I found:
[code]
$('#example').dataTable()
.columnFilter({
aoColumns: [ { type: "select", values: [ (POPULATED FROM COLUMN) ] },
[/code]
This discussion has been closed.
Replies
Allan
I managed to get the drop down menu to appear in the footer, but they're only showing the column headers...
Am I missing something?
[code]
$(document).ready(function() {
oTable = $('#search').dataTable(
{
"bStateSave": true,
"sAjaxSource": "process_search.php",
"aoColumns": [
{ "sName": "order", "sTitle": "Order", "sWidth": "5%"} ,
{ "sName": "case", "sTitle": "Case ID", "sWidth": "21%"} ,
{ "sName": "status", "sTitle": "Status", "sWidth": "9%"} ,
{ "sName": "priority","sTitle": "Priority", "sWidth": "12%"} ,
{ "sName": "region", "sTitle": "Region", "sWidth": "5%"} ,
{ "sName": "ruser","sTitle": "User", "sWidth": "10%"} ,
{ "sName": "rdate", "sTitle": "Date", "sWidth": "10%"} ,
{ "sName": "assignee","sTitle": "Assignee", "sWidth": "10%"} ,
{ "sName": "s_search", "sTitle": "Start", "sWidth": "10%"} ,
{ "sName": "e_search","sTitle": "End", "sWidth": "10%"}
],
"sPaginationType": "full_numbers",
"draggablerows": true,
"bJQueryUI": true,
"bSortClasses": false,
"iDisplayLength": 25,
"aLengthMenu": [
[25, 50, 100, -1],
[25, 50, 100, "All"]
]
})
.columnFilter({
aoColumns: [
null,
null,
{ type: "select" },
{ type: "select" },
{ type: "select" },
{ type: "select" },
null,
{ type: "select" },
null,
null
]
});
});
[/code]
[code]
.columnFilter({
aoColumns: [
null,
null,
{ type: "select" },
{ type: "select" },
{ type: "select" },
{ type: "text" },
{ type: "Date" },
{ type: "select", values: [ 'name1', 'name2', 'name3', 'name4' ] },
null,
null
]
[/code]
But if I use:
[code]
{ type: "select" },
[/code]
the rest of the filters become blank as well.
I am rather new to both datatables and columnfilter and to be honest I am still learning jquery so I apologize if the answer to this is obvious. I have to start somewhere and so far I have gotten on very well with your excellent tools!
I debated opening a new topic with a link to this post, but I decided I would try replying to it first.
Yeah only the current page is loaded so how can you possibly gather a list from the entire data set other than doing something in the server side script and populating the select that way.
I am not sure exactly the route to take on that but I will put some thought in to it.