Dynamically disabling the default filtering of dataTable

Dynamically disabling the default filtering of dataTable

naddy19naddy19 Posts: 8Questions: 0Answers: 0
edited July 2012 in DataTables 1.9
Hi,

I want to disable the default filtering of dataTable dynamically on a particular condition but i don't want to disable custom filtering. I had tried to change the 'sDom' string at run time, but it had no effect. I had also tried setting the 'bFilter' variable to false but doing this disables my custom filtering also.

What i need is somewhat like this

[code]

if (certain condition) {
disable the default dataTable filtering
}
//other code which needs to be executed with filtering disabled

if (certain condition) {
re-enable the filtering
}

// code which needs to be executed with filtering enabled

[/code]


Anyone please help me out with it.


Thanks

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    Quick idea: Is it possible to call the default filtering in your custom filtering? So you disable default filtering, and call the default filter in your custom filter. Something like:

    [code]
    function myCustomFilter(){
    if (!certain condition) {
    /* run default filter */
    }

    /* run custom filter */
    }
    [/code]
  • naddy19naddy19 Posts: 8Questions: 0Answers: 0
    Hi koosvdkolk,

    Actually the default filtering works before the custom filtering is applied.

    The following is the code snippet from the dataTables plugin(lines 2029 - 2041) which filters the rows

    [code]
    /* Global filter */
    _fnFilter( oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive );
    fnSaveFilter( oInput );

    /* Now do the individual column filter */
    for ( var i=0 ; i
  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    And what about adding your own search box?

    http://live.datatables.net/eyixob/edit#javascript,html,live
  • naddy19naddy19 Posts: 8Questions: 0Answers: 0
    Hi koosvdkolk,

    Thanks a lot for your suggestion, your solution meets my requirement. I will use this in my project.
This discussion has been closed.