phillyinsd / jquery-datatables-column-filter

Automatically exported from code.google.com/p/jquery-datatables-column-filter
0 stars 0 forks source link

default filter for a column #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to set an initial value for a filter. We are able to do this with 
datatables oSearch variable but I can't see how to do this on a specific column.

<script type="text/javascript">
$(document).ready(function() {
    $('#offersReachedReport').dataTable(
        {
            "bProcessing": true,
            "bServerSide": true,
            "oSearch": {"sSearch": "Initial Search"},
            "sAjaxSource": "/InternalUse/utilities/offerReachedReport_action.cfm",
                  "fnServerData": function( sUrl, aoData, fnCallback ) {
                      $.ajax( {
                          "url": sUrl,
                          "data": aoData,
                          "success": fnCallback,
                          "dataType": "json",
                          "cache": false
                      });
                  }
        }

    ).columnFilter(
        {   
                    aoColumns: [    
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    null,
                                    { type: "date-range" },
                                    null
                                ]

        }

    );
} );
</script>

Original issue reported on code.google.com by henkem...@gmail.com on 30 Jan 2014 at 9:31

GoogleCodeExporter commented 9 years ago
You will need to manually set valuse using a aoPreSearchCols fields, e.g.:

fnSettings().aoPreSearchCols[ i ].sSearch  values

In addition, you can set values in the filter using standard jQuery.

See: 
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/serverSideInitFi
lter.html

Original comment by joc...@gmail.com on 4 Feb 2014 at 12:35