editor on create not firing

editor on create not firing

classic12classic12 Posts: 228Questions: 60Answers: 4
btnGetData.onclick=function(){
      editor = new $.fn.dataTable.Editor( {
      

        ajax: "http://xxx.com/php/upload-many.php",
        table: "#dtQuotes",
        fields: [ {
                label: "Quote ID:",
                name: "quotes.quoteID"
            },{
                label: "Cust ID:",
                name: "quotes.custID"
            }, {
                label: "Quote Title:",
                name: "quotes.quoteTitle"
            }, {
                label: "Notes:",
                name: "quotes.notes"
            }, {
                label: "Notes Internal:",
                name: "quotes.notesInternal"
            },{
                label: "Site:",
                name: "quotes.site",
                type: "select"
            }, {
                label: "Images:",
                name: "files[].id",
                type: "uploadMany",
                display: function ( fileId, counter ) {
                    return '<img src="'+editor.file( 'files', fileId ).web_path+'"/>';
                },
                noFileText: 'No images'
            }
            

        ]
        

    } );
    
      editor.on( 'create', function ( e, type ) {
     // Type is 'main', 'bubble' or 'inline'
     alert( 'new row created' );
} );

Is this the correct syntax and placement ?

The alert is not firing.

What I am after doing is updating the datatable after a new row is created with the editor.
Cheers
Steve Warby

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    That looks correct, and it appears to work okay in this example if I put this into the console:

    editor.on( 'create', function ( e, type ) {
      console.log('created');
    } )
    

    Can you link to a test case showing the issue please?

    Allan

This discussion has been closed.