webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
796 stars 271 forks source link

Make a row readonly #144

Closed saintelaitlait closed 8 years ago

saintelaitlait commented 8 years ago

Hey guys, is it possible to make a row readonly instead of a column?

Thank you!

jybeaujean commented 8 years ago

Sure ! You have to create a dedicated Editor that checks if the cell is editable or not.

setCellEditor("firstname",new MyOwnEditor({});

https://github.com/webismymind/editablegrid/blob/master/editablegrid_editors.js

saintelaitlait commented 8 years ago

Thank you my friend!

louisantoinem commented 8 years ago

If you just want to make the row read-only, implementing the callback "isEditable" is the easiest solution. It allows to decide dynamically if a column, row or cell should be editable or read-only.

Example:

myEditableGrid.isEditable = function(rowIndex, columnIndex) {
    // make first row readonly
    return rowIndex > 0;
};