New row in editor

New row in editor

curamuscuramus Posts: 4Questions: 2Answers: 0

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
                // This is what I actually need, but it doesen't work. There is no error or anything
                //    .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
                    .set('field', value)
                    .title('New row')
        // }

This question has an accepted answers - jump to answer


  • colincolin Posts: 10,137Questions: 0Answers: 1,698
    Answer ✓

    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.



  • curamuscuramus Posts: 4Questions: 2Answers: 0

    Thank you @colin, works perfectly :)

This discussion has been closed.