How to connect jQRangeslider values to search action?

How to connect jQRangeslider values to search action?

TerradonTerradon Posts: 16Questions: 5Answers: 2

I have a slider added in a div inside a footer th-cell.
I am able to create an alert for the min/max date as search argument for my date column
But how do i fire the search??
I have tried something (see code) but that just does not work. Nothing happens according Firebug.
Please, help?

    d = new Date();
    year = d.getFullYear();
    month = d.getMonth();
    day = d.getDate(); 
    
    $("#dateslider").dateRangeSlider({
            bounds: {
                min: new Date((year - 1), month, day),
                max: new Date(year, month, day) 
                },
            defaultValues:{
                min: new Date((year - 1), month, day),
                max: new Date(year, month, day) }});
    
    var slider = $("#dateslider").dateRangeSlider();
    
    $("#dateslider").bind("valuesChanged", function(e, data){
        
        var dmin = new Date(data.values.min);
        var dmax = new Date(data.values.max);
        var datemin = (dmin.getFullYear() + "-" + (dmin.getMonth() + 1) + "-" + dmin.getDate());
        var datemax = (dmax.getFullYear() + "-" + (dmax.getMonth() + 1) + "-" + dmax.getDate());
        
        searchdate = (datemin + "-tot-" + datemax);
        alert(searchdate);
        //slider.columns(0).search( searchdate).draw(); // not working

        }); 

Answers

  • TerradonTerradon Posts: 16Questions: 5Answers: 2
    edited February 2015

    Took me a few days, but i found the solution:

    // table has been defined before:
    table = $(\'#mijnlogboek\').DataTable();
    
    //changed
    slider.columns(0).search( searchdate).draw();
    //to
    table.columns(0).search( searchdate).draw();
    

    that's all!

    P.S.
    I cannot accept my own answer and also cannot change title to make clear this problem is solved :(

This discussion has been closed.