Row level editability
Row level editability
mak1
Posts: 25Questions: 13Answers: 1
Hi Allan,
I know I can make certain columns editable and not using a server side role
var editor = new $.fn.dataTable.Editor( {
ajax: ...,
table: ...
} );
if ( userAccess === ... ) {
editor.add( {
label: 'Name',
name: 'username'
} );
}
if ( userAccess === ... ) {
editor.add( ... );
}
Question, in our use case, once a row/record has been submitted to a manager, none of its field should be editable. Meaning I need to be able to turn on edit access on a row by row basis based on a column status....is that possible?
This discussion has been closed.
Answers
The built in controls doesn't really allow for that, instead you will need to call the
edit()
method yourself (rather than using whatever method you are currently using to do it - the Buttons?). You would surround theedit()
call with whatever logic you need to decide whether the form should be displayed or not.The alternative is to use
preOpen
- i.e. allow theedit()
method to be called as before, but then cancel the form from being displayed, again based on whatever logic you need.Allan
I am using the Edit button and Inline edit. Any suggestions for inline edit?
Basically the same as my first suggestion - use some
if
condition based on whatever logic you need to decide if you want to call theinline()
method or not.row().data()
will probably be useful to get the row's data.Allan