Search code examples
jqueryyadcf

Delaying filtering until button click with yadcf plug-in


I want to prevent yadfc from applying any filtering until a certain click event happens - ie. the user would set the filter parameters and then click an 'apply filters' button - is there any way to only trigger the filtering manually via a click event?

Thanks, Robin


Solution

  • Yep, you are looking for the externally_triggered: true option, I've added this recently, see externally_triggered showcase page (see code snippet in the bottom of the page) and see relevant issue

    Code sample:

     oTable = $('#example').dataTable({...
     }).yadcf([
            {
                column_number : 0, 
                filter_container_id: 'external_filter_container_0',
            },
            {
                column_number : 1,
                filter_container_id: 'external_filter_container_1',
                filter_type: 'range_number_slider'
            },
            {
                column_number : 2,
                filter_container_id: 'external_filter_container_2',
                filter_type: 'range_date'
            },
          ],
          { 
            externally_triggered: true
          });