Editor duplicate not working

Editor duplicate not working

epoch1epoch1 Posts: 17Questions: 8Answers: 1

Hi,

I have a system that uses Editor and users would like to have the ability to copy rows, I have added the code below and my modal window opens in Edit view but the mode doesn't change to Create, the editor.mode appears to be null:

     new $.fn.dataTable.Buttons( dt, {
        buttons: [
            { extend: "create", editor: editor, className: 'btn-success' },
            { extend: "editSingle",   editor: editor, className: 'btn-warning' },
            { extend: "remove", editor: editor, className: 'btn-danger' },
            { extend: "selected", text: "Copy",
              enabled: false,
              className: 'buttons-copy btn-primary',
              action: function ( e, d, node, config ) {
                
                var mode = editor.mode();
                console.log( 'Editor form displayed for a '+mode+' action' );

                    editor.edit( dt.rows( {selected: true} ).indexes(), {
                            title: 'Copy Request',
                            buttons: 'Save'
                        } );
                    editor.mode( 'create' );
                }
            }
        ]
     });

The only difference between my code and the duplicate example given that I can see is that I'm using new $.fn.dataTable.Buttons() to create my buttons rather than doing it in the datatable options - I think I did it this way due to the placement of my buttons. Allan can you help please?

Cheers

This question has an accepted answers - jump to answer

Answers

  • epoch1epoch1 Posts: 17Questions: 8Answers: 1
    Answer ✓

    OK, looks like I was using an older version of editor, facepalm moment!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Thanks for the update, good to hear you've got it working.

    Allan

This discussion has been closed.