how can I tell if the Editor instance that got opened is New, or Ed
how can I tell if the Editor instance that got opened is New, or Ed
aziegler3
Posts: 47Questions: 11Answers: 1
I have this
buttons: [
{ extend: 'create', editor: editor },
{ extend: "edit", editor: editor }
]
next, I want to make some decisions on what to show and what not to show in an "edit" window,
I was trying to use something like this:
editor.on( 'open', function ( e, something) {
if(something == 'xyz'){
actions to hide fields
}
} );
is there a parameter, value, property that I can find in the editor that I can evaluate to decide if this particular form is a "create" or an "edit"?
I saw this example, which uses the 'type', but that is the same for Create and Edit.
Thanks for any help on this.
This question has an accepted answers - jump to answer
Answers
The
open
has a parameteraction
that was introduced in 1.5. This will allow you to see if its a create, edit or remove operation.Kevin
You can also use
mode()
to determine what the editing mode is, or set the fields up as needed in separateinitCreate
andinitEdit
event handlers.Allan
I need something like that what I need.
Unfortunately, I am probably doing something wrong, because
always evaluates to "main" regardless of opening the New, or the Edit buttons.
Note that the
open
event has three parameters, for example:With your code
action
is referencing the second parameter which ismode
.Kevin
OMG! of course!
Thanks, this is what i needed.