priyanka patel
priyanka patel

Reputation: 637

date filter type is not working in yadcf plugin

i have column which display date in it. i am using datatable for display tables. i have render date column using datatable's column Render function and use yadcf column filter plugin for filter data. it display datepicker in filter element but not filter data after selecting date from it.

$(table_id).dataTable({
        aaData: $.parseJSON(records), 
"aoColumnDefs": [{
                "bSortable": false,
                "aTargets": [1], // <-- gets last column and turns off sorting
                "mData": null,
                "mRender": function(data, type, full) {
                    var cdate = row.date;
                    return cdate.replace(/(\d{4})-(\d{2})-(\d{2})/, "$3-$2-$1");
}}]
}).yadcf([{column_number: 1, filter_type: "date"}]);

Upvotes: 1

Views: 2529

Answers (1)

Daniel
Daniel

Reputation: 37061

Try the latest yadcf version and also since you are using the - as date sepaartor you need to feed yadcf with the date_format: 'dd-mm-yy'

Updated code:

.yadcf([{column_number: 1, 
         filter_type: "date", 
         date_format:  'dd-mm-yy'
}]);

Here is a working jsfiddle (not sure if you meant to use dd-mm-yy or mm-dd-yy)

Upvotes: 1

Related Questions