Search code examples
javascriptjquerydatatablesdropdownbox

Jquery - Datatables Dropdown Issue


I want to create a dropdown select for a single column for my jquery datatable.

The data source is a mysql db I retrieve with php.

Using the most basic setup the dropdown works but when I set more options I only get an empty dropdown. In this Fiddle I don't get a dropdown at all but I might be missing something.

I think this is the part where I have an error:

            var table = $('#example').DataTable({
              "pagingType": "full_numbers",

                "oTableTools": {
              "sSwfPath" : "swf/copy_csv_xls_pdf.swf",
                "sRowSelect": "multi"
        }
        });
    table.columnFilter({
        "sPlaceHolder" : "head:after"
    });

If I just put var table = $('#example').DataTable() and remove table.columnFilter I get the dropdown.

What am I missing here?

Thank you.


Solution

  • Firstly, your jsfiddle doesn't work because jsfiddle doesn't have datatables. Use http://live.datatables.net if you want datatables.

    Remove

    table.columnFilter({
        "sPlaceHolder" : "head:after"
    });
    

    because it's not a part of datatables

    Then just follow the example on http://datatables.net/examples/api/multi_filter_select.html