Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7676397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:11:25+00:00 2026-05-31T17:11:25+00:00

I have a datefilter for datatables using a calendar image and it works great.

  • 0

I have a datefilter for datatables using a calendar image and it works great.
But when I clear the date it does not show all dates.

How can i make a button to show all dates which would clear the date filter?

Any help/advice on this would be great, thank you in advance.

// The plugin function for adding a new filtering routine
$.fn.dataTableExt.afnFiltering.push(
        function(oSettings, aData, iDataIndex){
            var dateStart = parseDateValue($("#dateStart").val());
            // aData represents the table structure as an array of columns, so the script access the date value 
            // in the first column of the table via aData[0]
            var evalDate= parseDateValue(aData[3]);

            if (evalDate == dateStart ) {
                return true;
            }
            else {
                return false;
            }

        });

// Function for converting a mm/dd/yyyy date value into a numeric string for comparison (example 08/12/2010 becomes 20100812
function parseDateValue(rawDate) {
    var dateArray= rawDate.split("/");
    var parsedDate= dateArray[1] + dateArray[0] + dateArray[3];
    return parsedDate;
}



$(function() {
    // Implements the dataTables plugin on the HTML table
    var $oTable= $("#example").dataTable( {
        "iDisplayLength": 20,
        "oLanguage": {
            "sLengthMenu": 'Show <select><option value="25">25</option><option value="50">50</option><option value="100">100</option><option value="200">200</option></select>'
        },
        "bJQueryUI": true,
        "aoColumns": [
                null,
                null,
                null,
                { "sType": "date" }
        ]                   
        }); 


    // The dataTables plugin creates the filtering and pagination controls for the table dynamically, so these 
    // lines will clone the date range controls currently hidden in the baseDateControl div and append them to 
    // the feedbackTable_filter block created by dataTables
    $dateControls= $("#baseDateControl").children("div").clone();
    $("#feedbackTable_filter").prepend($dateControls);

    // Implements the jQuery UI Datepicker widget on the date controls
    $('.datepicker').datepicker(
        {dateFormat: 'DD, d MM, yy', showOn: 'button', buttonImage: '../images/calendar.jpg', buttonImageOnly: true}
    );      

    // Create event listeners that will filter the table whenever the user types in either date range box or
    // changes the value of either box using the Datepicker pop-up calendar
    $("#dateStart").keyup ( function() { $oTable.fnDraw(); } );
    $("#dateStart").change( function() { $oTable.fnDraw(); } );

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:11:26+00:00Added an answer on May 31, 2026 at 5:11 pm

    Well, have you tried:

    $.fn.dataTableExt.afnFiltering.push(
            function(oSettings, aData, iDataIndex){
                var dateStart = parseDateValue($("#dateStart").val());
                //if filter is empty return everything
                if(dateStart === ''){
                    return true;
                }
                // aData represents the table structure as an array of columns, so the script access the date value 
                // in the first column of the table via aData[0]
                var evalDate= parseDateValue(aData[3]);
    
                if (evalDate == dateStart ) {
                    return true;
                }
                else {
                    return false;
                }
    
            });
    

    if this doesn’t work can you post an example on jsfiddle?

    EDIT – ok the problem was with parseDateValue() which was expecting a date create with /. Since you want an exact match, you can omit parseDateValue()

    // The plugin function for adding a new filtering routine
    $.fn.dataTableExt.afnFiltering.push(
        function(oSettings, aData, iDataIndex){
            var dateStart = $("#dateStart").val();
            //if filter is empty return everything
            if(dateStart === ''){
                return true;
            }
            // aData represents the table structure as an array of columns, so the script access the date value
            // in the first column of the table via aData[0]
            var evalDate= aData[3];
    
            if (evalDate == dateStart ) {
                return true;
            }
            else {
                return false;
            }
    
        });
    

    fiddle here http://jsfiddle.net/eMZtV/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I may have have the wrong end of the stick here, but I thought
I have a model which describes an event like this: class Event(models.Model): date =
I have tried reinstalling netbeans, I have tried reinstalling java. I'm not sure what's
Have written all the code in a silverlight class library (dll) and linked this
Have a problem that seems easy on paper but i'm having a big problem
I have this javascript for automatically setting a date filter to the first and
Have any one tried to activate fancybox thumbnail gallery using a button or an
I have an existing templatetag, show_next_event : def show_next_event(): try: e = Event.objects.filter(published='1').order_by('date').filter(date__gte=datetime.date.today())[0] except

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.