trying to add bootstrap-datepicker to search/filter

trying to add bootstrap-datepicker to search/filter

aaronwinslowaaronwinslow Posts: 3Questions: 2Answers: 0

Hello,

I'm trying to add bootstrap-datepicker (https://github.com/eternicode/bootstrap-datepicker) to the filter/search input area either in addition to the search box or in its place. I added:

$('#mytable_filter input').datepicker({

});

Any help is appreciated.

Answers

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    edited August 2015

    If bootstrap-datetimepicker is good enough you can use it with my yadcf plugin.

    See sample page

        var datepickerDefaults = {
            showTodayButton: true,
            showClear: true
        };
    
        $('#example').dataTable().yadcf([
            {column_number: 4, filter_type: "range_date", datepicker_type: 'bootstrap-datetimepicker', date_format: 'YYYY-MM-DD', filter_plugin_options: datepickerDefaults}
        ]);
    
  • aaronwinslowaaronwinslow Posts: 3Questions: 2Answers: 0

    Thank you, daniel_r!

    I like the yadcf plug-in very much and tried to implement it before posting. I'd still be very happy to use it, but I could not figure out how to use the datepicker in yadcf to filter on a column that is not visible without the column then rendering as visible. I recognize that it's an odd requirement and that I probably should have mentioned it initially. Any ideas?

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    to filter a column that is not visible you just have to place the filter outside that column like in this example notice the third column filter, scroll down and inspect the code used on that page , especially

    {
            column_number: 2,
            filter_type: "range_date",
            filter_container_id: "external_filter_container"
    }
    

    Read about filter_container_id

This discussion has been closed.