New row in editor
New row in editor
Hi guys,
I'm struggling to add a new row to my editor as soon as another field is edited. I've looked in API, tried some examples, but it simply won't work.
What I basically want is this:
editor.on('postEdit', function (e, json, data, id) {
// do some calculation
// if (calculation == true) {
// This works perfectlly fine, I instantly see the new row, but I can't edit it
//var rowNode = $('#table').DataTable().row.add({
// "field": value
//}).draw();
// This is what I actually need, but it doesen't work. There is no error or anything
//editor.create(false)
// .set('field', value)
// .submit();
// This is how I currently do it,
// but it would be better if the row would be instantly created without the form
editor.create(true)
.set('field', value)
.title('New row')
.buttons("Create")
.submit();
// }
})
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @curamus ,
The place to do that is in the
submitComplete
, otherwise the previous edit would still be in progress. See this example here - if you set the age to be 100, it creates that empty row as required.Cheers,
Colin
Thank you @colin, works perfectly