Skip to content

Commit

Permalink
Applied Tomer Simis patch mindmup#11
Browse files Browse the repository at this point in the history
  • Loading branch information
GlenConway committed Jun 13, 2015
1 parent 4932ac1 commit 31672a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1>editableTableWidget<br/> <small>tiny editable jQuery Bootstrap spreadsheet</
<tr><td>Bike</td><td>330</td><td>240</td><td>1</td></tr>
<tr><td>Plane</td><td>430</td><td>540</td><td>3</td></tr>
<tr><td>Yacht</td><td>100</td><td>200</td><td>0</td></tr>
<tr><td>Segway</td><td>330</td><td>240</td><td>1</td></tr>
<tr><td class="edit-disabled">Segway <- Editing disabled</td><td>330</td><td>240</td><td>1</td></tr>
</tbody>
<tfoot><tr><th><strong>TOTAL</strong></th><th></th><th></th><th></th></tr></thead>
</table>
Expand Down Expand Up @@ -97,6 +97,11 @@ <h2>Usage</h2>
return false; // reject change
}
});
</pre>

<p>Disable editing on some cells by adding a class to them</p>
<pre class="prettyprint">
$('#table').editableTableWidget({disableClass: "edit-disabled"});
</pre>
</div>
<div class="span6" >
Expand Down
3 changes: 2 additions & 1 deletion mindmup-editabletable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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: $('<input>')
};

0 comments on commit 31672a2

Please sign in to comment.