How to use date range filter and filter on the same table? - Page 2

How to use date range filter and filter on the same table?

2»

Answers

  • FRS4002FRS4002 Posts: 85Questions: 11Answers: 0
    edited July 2022

    @kthorngren Ok nice, I edited the code so it become like this http://live.datatables.net/mojavivu/1/edit
    to make the search box with the same row/div of the date range filter. So, I commented div.toolbar and I removed <toolbar> from dom. I also wrote
    $('#max').after('<label>Search:</label><input type="search" class="dataTables_filter_custom">');
    inside intiComplete but the search bar suddenly stopped working...

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    Answer ✓

    Since you changed the HTML structure by removing the div with the classname dataTables_filter_custom and placed that classname on the input tag you need to update these two selectors by removing input:

        let search = $('.dataTables_filter_custom input').val();
    
      $('.dataTables_filter_custom')
      .on('keyup input', function() {
        $('#example').DataTable().draw();
      });    
    

    Like this:
    http://live.datatables.net/zihipehi/1/edit

    Kevin

Sign In or Register to comment.