ColumnfilterWidgets: Successfully set filters via JS, but cannot remove them...

ColumnfilterWidgets: Successfully set filters via JS, but cannot remove them...

mibaasmibaas Posts: 19Questions: 0Answers: 0
edited April 2014 in Plug-ins
Hi,

I have managed to set default-values for filters by running [code]"fnDrawCallback": function (oSettings) {
$("#myTable_wrapper .column-filter-widget:eq(1) option:contains('string')").attr('selected','selected').change();
}[/code], but unfortunately the user is not able to clear these filters: clicking on the term (as with manully selected terms) does not remove the term from the filter. I was hoping the JS would trigger the same actions as when a user clicks an item in the filter-dropdown, but somehow there is a difference....?

Thanks

Michael

Replies

  • mibaasmibaas Posts: 19Questions: 0Answers: 0
    Found the problem! That wonderful piece of code needs to run on fnInitComplete, not DrawCallback.
  • NicoFernaNicoFerna Posts: 2Questions: 0Answers: 0

    Hi mibaas,

    I am trying to do exactly the same as you, prefilter the table on page load but still allow the user to deselect the applied filters. Using ColumnfilterIwdgets.
    However, there are no "column-filter-widget" classes to be found in my table, and obviously your code doesn't work for me.

    Which version of clumn filter widget do you use?

    Thanks,
    Nicolas

  • NicoFernaNicoFerna Posts: 2Questions: 0Answers: 0

    Well, got it to work after all, thanks for your excellent piece of code Michael! (i was simply referencing the wrong column)

This discussion has been closed.