use json data in editor title ?
use json data in editor title ?
i have an instance of editor, where, depending on the data, i want to change of the title on edit to something appropriate
i have managed to do this with a static value like so...
// Edit record
$('#orderdetails').on('click', 'a.editor_edit', function (e) {
e.preventDefault();
editor_2
.title( 'Return Item ?' )
.message ( 'Check the box to return the item back into stock')
.buttons( [
'Confirm',
{ label: 'Cancel', fn: function () { this.close(); } }
] )
.edit( $(this).closest('tr') );
} );
but can't customise it further
for the title, i tried
.title( 'return item'+ editor_2.field('tblorderdetails.DetailItemID').val() )
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Your best bet is to pass the
title
option (and actuallymessage
andbuttons
) in using theform-options
property that you can pass intoedit()
.That is a good way of doing it, as otherwise the
edit()
method will trigger the display using the default options. It also removes any possibility of async issues if you happen to use inline editing, either now or in future.Allan
Ok, I think I got it
This appears to work great, so long as the field tblorderdetails.PatronPaymentID is in my editor instance, and is not set to hidden.(or display)
However, I don't want to see the field in the editor, but setting its type to hidden or display will not load any title or message
Reason it didn't work was I was checking for an empty string, so the null returned was throwing an error, (so I assume when the field was visible, then the value wasn't null ?)
anyway i changed
to