jquery - How to add options in ColumnFilterWidgets after initializing the plugin -
i have following code in file called initializing_jquery_datatables.js:
$(document).ready(function() { $('.table').datatable( { "sdom": "<'row'w<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>t", "spaginationtype": "bootstrap", "bdestroy": false, "ocolumnfilterwidgets": { "sseparator": "\\s*/+\\s*", "aiexclude": [ 0 ] } ... });
i filter , exclude columns in js file this:
$.extend( true, $.fn.datatable.defaults, { "ocolumnfilterwidgets": { "aiexclude": [ 10 ] } });
and doesn't work
hmm, seems columnfilterwidgets not support changing defaults, in issue
only way got running totally reinitializing table.
// code goes here $(function() { otable = $("#datatable").datatable({ "sdom": "<'row'w<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>t", "spaginationtype": "bootstrap", "bdestroy": true, "ocolumnfilterwidgets": { "sseparator": "\\s*/+\\s*", "aiexclude": [0] } }) }) function change(){ otable = $("#datatable").datatable({ "sdom": "<'row'w<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>t", "spaginationtype": "bootstrap", "bdestroy": true, "ocolumnfilterwidgets": { "sseparator": "\\s*/+\\s*", "aiexclude": [2] } }) }
note bdestroy must true.
just click 'click me' button , ignore lousy layout. might related updated bootstrap pagination plugin first/last buttons or missing css.
sorry can't further:-/
Comments
Post a Comment