zepernick / Codeigniter-DataTables

CodeIgniter Library For Ajax Server Side DataTables 1.10 >
MIT License
94 stars 94 forks source link

Custom search in ajax data #14

Closed iprastha closed 8 years ago

iprastha commented 8 years ago

Hi, first of all a great and very useful library! I have a custom search in my datatable using the ajax.data implementation, something like this:

$('#mytable').dataTable( {
        processing: true,
        serverSide: true,
        ajax: {
            "url"  : "myajaxurl.php",
            "type" : "POST",
            "data"   : function (d){
                d.my_custom_filter = $('#my_custom_filter').val();
            }
        }, ...

How do I pass the "my_custom_filter" value into the database query as an additional where statement ?

Thank You

zepernick commented 8 years ago

@iprastha you can accomplish this in the whereClauseArray method.. Here is another issue that has an example of how to do it

iprastha commented 8 years ago

Thanks! Got it to work now using the example given in that post.