i using datatables plugin autofill extension input elements outlined here: datatables' autofill extension input elements not working. works well. however, unable disable autofill specific columns. when use "enable": false option, , set specific columns, callbacks stop working. know if there way disable columns autofill, while still allowing callbacks function properly? following disables cols 1-4, read/write/step functions no longer copy edited input values:
new $.fn.datatable.autofill(table, { "columndefs": [{ "targets": [5, 6, 7, 8, 9], "read": function (cell) { return $('input', cell).val(); }, "write": function (cell, val) { return $('input', cell).val(val); }, "step": function (cell, read, last, i, x, y) { return last === undefined ? read : last; }, "enable": false, "targets": [1,2,3,4] //omitting leaves columns enabled. }] });
the way you've written it, defining targets property twice in same object. need give columndefs object pointing other targets. so:
new $.fn.datatable.autofill(table, { columndefs: [ { targets: [5, 6, 7, 8, 9], read: function (cell) { return $('input', cell).val(); }, write: function (cell, val) { return $('input', cell).val(val); }, step: function (cell, read, last, i, x, y) { return last === undefined ? read : last; } }, { targets: [1,2,3,4], enable: false } ] });
Comments
Post a Comment