ColVis: “Restore original” button does not trigger fnStatechange

ColVis: “Restore original” button does not trigger fnStatechange

antoniosoutoantoniosouto Posts: 2Questions: 0Answers: 0
edited March 2012 in Plug-ins
Hello.

First of all I am a DataTables Fan! Allan: Great Job with it and with ColVis as well!

I am using ColVis in a table with individual column filters and I use fnStateChange to remove/reapply the column filter when I hide/restore it. As I have a lot of columns I let some of them initially hidden and set bRestore to true, so the user may change the columns visibility at will and return to the original view with just one click.

Everything works just fine when I click on the columns checkboxes. But if I click on the restore button fnStatechange is not triggered, even though the columns visibility state has changed. Is that the expected behaviour?

I am using DataTables 1.8.2 and ColVis 1.0.6

Best Regards,

Replies

  • antoniosoutoantoniosouto Posts: 2Questions: 0Answers: 0
    Just for the record, I was able to workaround it by attaching an event listener to the button:

    $('button.ColVis_Restore').live('click', function() {
    oTable.dataTableSettings[ 0 ].aoColumns[ originaly_hidden_column_id_a ].bSearchable = false;
    oTable.dataTableSettings[ 0 ].aoColumns[ originaly_hidden_column_id_b ].bSearchable = false;
    ...
    oGridTable.fnDraw();
    });
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    edited March 2012
    I've just been digging around the code a bit and can't see any reason why this wouldn't work, although I am using DataTables 1.9 and ColVis 1.0.7. I've also just modified my examples to try this and as far as I can tell this is working okay, so I think you might just need to update.

    Allan
This discussion has been closed.