How protect a row from edit and delete
How protect a row from edit and delete
Hello.
I can't find any solution in the forum for my problem.
In my database the first 3 entrys are protcted and a user is not allowed to use the edit and delete button for these entrys only.
He can insert new entrys and edit and delete this but not the first 3.
How can I make this?
Rappi
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Is there some way in which these rows are identified - for example a class name? Also, what form of editing are you using - full form, inline, bubble?
Allan
Hi Allen.
Thanks for your reply.
I'am using full form and the rows can identified by id.
Here are my source:
HTML
Processing
/*
* Editor client script for DB table tierart
* Created by http://editor.datatables.net/generator
*/
(function($){
$(document).ready(function() {
} );
}(jQuery));
```
The first 3 entrys have id 1-3 in the database.
I hope this help and there is a solution
Rappi
The line
is temporary disabled.....
What I would suggest is replacing
{ extend: "edit", editor: editor }
with something like:So basically you are calling
edit()
yourself (rather than using the default action of theedit
button). Using the DataTables API we can check to see if any of the rows that are selected show not be editable.An alternative option is to listen for the
select
event - check to see if the row that was selected is one that shouldn't be editable. If so then immediately deselect it (row().deselect()
). That might be easier thinking about it :-)Allan
Hi Allan.
It don't work :-(
Now I have this:
The Edit Botton is always active and when I click on it, the editor opens but without an Save Botton....
And it is the same wherever I click on...
The second way I don't understand :-( My javascript is terrible ;-) I can write PHP and MySQL but javascript......
Rappi
Let's do it the second way - that will be easier I think.
You just need to fill in the
if
condition with whatever is suitable for your use case.Allan