Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Disable editing on a cell. Only using javascript #18

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


editable-table
=================

Expand All @@ -20,6 +22,16 @@ Basic Usage

See http://mindmup.github.com/editable-table/

Extended Features
-----------

1. Added the possibility to prevent edit of certain columns. Maybe you have a remove link or something that should be handled differently. For example if second and third column not should be editable, you simply initializes the table as:
```example
$('#table').editableTableWidget({ editor: $('<input>'), preventColumns: [ 2, 3 ] });
```

Thanks Gojko Adzic for a nice and light weighted library!

Dependencies
------------
* jQuery http://jquery.com/
7 changes: 7 additions & 0 deletions mindmup-editabletable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ $.fn.editableTableWidget = function (options) {
showEditor = function (select) {
active = element.find('td:focus');
if (active.length) {

// Prevent edit of the columns specified
if ($.inArray(active.index() + 1, activeOptions.preventColumns) != -1) {
active.blur();
return;
}

editor.val(active.text())
.removeClass('error')
.show()
Expand Down