Custom button to view the form
Custom button to view the form

Hello,
I have created a custom button to view the form. It is working fine but when I disable all fields it affect also the edit button. So basically I want to disable all fields on the form when the custom view button is clicked. My problem is that it disables all the fields when edit button is clicked also. I want to disable only for the view button.
Here is my code for the view button.
buttons: [
{
extend: "selected",
text: 'View',
name: 'view',
action: function ( e, dt, node, config ) {
// Start in edit mode, and then change to create
editor.edit(table.row( { selected: true } ).index(), {
title: 'View Branch',
buttons: 'Close'
});
editor.disable();
e.preventDefault();
}
},
{ extend: 'create', name: 'new', editor: editor },
{ extend: 'edit', name: 'edit', editor: editor },
{ extend: 'remove', name: 'delete', editor: editor }
Regards
This question has an accepted answers - jump to answer
Answers
See if you can use
enable()
in theclose
event.Kevin
Must I remove the editor.disable();?
Must I remove the editor.disable();?
No.
When the form is closed the
close
event will be triggered. This is what I had in mind:Kevin
Thank you very much, it is working.