I am looking to have some columns have select inputs and the rest have text inputs. I haven't been able find any examples. Is it possible to do this?
This question has an accepted answers - jump to answer
Here are examples of each:
One option is to add a class to the columns that indicate the type of search you want then in the columns().every() loop you can use a selector as described in the columns() docs to choose which columns to apply the search input or drop down.
I am really struggling to work out how put a select field in column 1 only and leave input fields for the rest. Here is what i have already. http://live.datatables.net/jomoruma/4/edit
Ok, i'm a little closer. http://live.datatables.net/jomoruma/6/edit
Just can't get it show in the correct row. Its showing on the row above the input.
Great, thanks for the example. Made a couple changes and it seems to work better:
1. Added "B" to a few rows of column 0 for testing
2. Add class ".text-input" to the 2nd footer columns with input searches
3. Changed the loop to create the inputs to this: $('#example tfoot tr.cus-footer th.text-input').each( function () - added the class
4. Changed the code to "apply the search"
$('#example tfoot tr.cus-footer th.text-input').each( function ()
Hope this helps.
It is possible to populate the selector with all data from table? Currently it's populated only with displayed results. I am using server side pipelined method.
@madrian Your server script will need to build the options and return it in an Ajax response. When Datatables initializes a server side table the first Ajax request has draw parameter of 1. Your server script can look at the draw parameter and if 1 then it can build the options and return them as part of the initial Ajax response. You can then access the JSON response in the initComplete function.
It looks like you're new here. If you want to get involved, click one of these buttons!
DataTables designed and created by SpryMedia Ltd.
SpryMedia Ltd is registered in Scotland, company no. SC456502.