diff --git a/index.html b/index.html index 83acae5..bc87d2c 100644 --- a/index.html +++ b/index.html @@ -40,7 +40,7 @@

editableTableWidget
tiny editable jQuery Bootstrap spreadsheetBike3302401 Plane4305403 Yacht1002000 - Segway3302401 + Segway <- Editing disabled3302401 TOTAL @@ -97,6 +97,11 @@

Usage

return false; // reject change } }); + + +

Disable editing on some cells by adding a class to them

+
+$('#table').editableTableWidget({disableClass: "edit-disabled"});
 
diff --git a/mindmup-editabletable.js b/mindmup-editabletable.js index 36be540..3a679ff 100644 --- a/mindmup-editabletable.js +++ b/mindmup-editabletable.js @@ -14,7 +14,7 @@ $.fn.editableTableWidget = function (options) { active, showEditor = function (select) { active = element.find('td:focus'); - if (active.length) { + if (active.length && !active.hasClass(activeOptions.disableClass)) { editor.val(active.text()) .removeClass('error') .show() @@ -126,6 +126,7 @@ $.fn.editableTableWidget.defaultOptions = { cloneProperties: ['padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', 'text-align', 'font', 'font-size', 'font-family', 'font-weight', 'border', 'border-top', 'border-bottom', 'border-left', 'border-right'], + disableClass: 'edit-disabled', editor: $('') };