.ColunmFilter and oTable.fnFilter();

.ColunmFilter and oTable.fnFilter();

zxarrzxarr Posts: 12Questions: 1Answers: 0
edited July 2012 in General
Maybe there is a better way to do this, but I need to pull the search box from _GET, which I did and assigned it a variable of 'search'. When using the .columnfilter addon, the dropdown lists do not reflect what is in the table; just the header appears.

All I do, is add:

[code]
if (search != null) {
oTable.fnFilter(search);
}
[/code]

after the columnfilter(). This works well, and the search box is prepopulated.

So how can I get columnfilter to work as expected, or is there a better way to populate the search box at the top of datatables to allow the columnfilter to work?


Here is the datatables function in its entirety:

[code]
$(document).ready(function() {

oTable = $('#search').dataTable(
{
"sAjaxSource": "search_lookup.php",
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bSaveState": true,
"iDisplayLength": -1,
"iDisplayLength": 25,
"aLengthMenu": [
[25, 50, 100, -1],
[25, 50, 100, "All"]
],
"aoColumns": [
{ "sName": "caseid", "sTitle": "Case", "sWidth": "15%"},
{ "sName": "priority", "sTitle": "Priority", "sWidth": "2%"},
{ "sName": "dbid", "sTitle": "ID", "sWidth": "3%"},
{ "sName": "processid","sTitle": "PID", "sWidth": "3%"},
{ "sName": "percent", "sTitle": "Percent", "sWidth": "2%"},
{ "sName": "target","sTitle": "Target", "sWidth": "3%"},
{ "sName": "region","sTitle": "Region", "sWidth": "2%"},
{ "sName": "dc", "sTitle": "DC", "sWidth": "2%"},
{ "sName": "host","sTitle": "Host", "sWidth": "3%"},
{ "sName": "ip","sTitle": "IP", "sWidth": "5%"},
{ "sName": "status","sTitle": "Status", "sWidth": "2%"},
{ "sName": "completed_date","sTitle": "Completed Date", "sWidth": "12%"}
]
}).columnFilter({
aoColumns: [
null,
{ type: "select" },
null,
null,
null,
{ type: "select" },
{ type: "select" },
{ type: "select" },
null,
null,
{ type: "select" },
null
]
})
if (search!=null) {
oTable.fnFilter(search);
}
});
[/code]
This discussion has been closed.