custom button on editor form
custom button on editor form
The closest thing I could find to add a button on the Editor form is this
https://editor.datatables.net/examples/api/cancelButton.html
but, it's not quite what I am looking for.
I have a select input on the Editor. When they select a value I will want to make a button visible and depending on what they selected, change the text and action of the button.
RequestHeaderEditor.field('RequestHeader.ActonID').input().on('change', function (e, d) {
if (d === undefined) {
// The change was triggered by the end user on update rather than an auto set
RequestHeaderEditor.hide(['RequestHeader.EndDate', 'RequestHeader.ReplacedUserID'])
var actionID = RequestHeaderEditor.get('RequestHeader.ActonID');
switch (actionID) {
case 1: //add
RequestHeaderEditor.show(['RequestHeader.EndDate', 'RequestHeader.ReplacedUserID'])
// show button with caption of 'Next'
break;
case 2: //delete
// show button with caption 'Submit'
break;
case 3: //update
// show button with caption of 'Next'
break;
}
});
Then, on click of that button, I will do different actions depending on the value of actionID
Is that possible?
This question has an accepted answers - jump to answer
Answers
You could do something like this.
The button is hidden on form load. Then when something is entered into the
Name
field, the button is displayed with the text of the field.Would that work for you?
Colin
i will try that on Monday. Thank you.
side topic: What is the difference/advantage of using .dependent over using the .on('change') that I posted?
Basically none - that is exactly what
dependent()
is doing under the hood.Allan