Duplicate Action resulting in simple edit instead of create

Duplicate Action resulting in simple edit instead of create

gordonc200gordonc200 Posts: 39Questions: 7Answers: 0

Using the code here

https://editor.datatables.net/examples/api/duplicateButton

Specifically

{
                extend: "selected",
                text: 'Duplicate',
                action: function ( e, dt, node, config ) {
                    // Start in edit mode, and then change to create
                    editor
                        .edit( table.rows( {selected: true} ).indexes(), {
                            title: 'Duplicate record',
                            buttons: 'Create from existing'
                        } )
                        .mode( 'create' );
                }

my local setup simply edits the row when I try to duplicate a record. The action is an edit and not a create.

I thought it might be because I was using an out of date library but have changed to 1.8 and the same thing happens.

Any ideas?

This question has accepted answers - jump to:

Answers

  • gordonc200gordonc200 Posts: 39Questions: 7Answers: 0

    I hadn't updated the CDN but I'm struggling

    <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/v/bs-3.3.7/jqc-1.12.4/jszip-3.1.3/pdfmake-0.1.27/moment-2.18.1/ed-mask-1.13.4/ed-quill-1.2.4/select2-4.0.1/selectize-0.12.1/dt-1.10.15/af-2.2.0/b-1.3.1/b-colvis-1.3.1/b-html5-1.3.1/b-print-1.3.1/cr-1.3.3/ef-display-1.6.2/ef-mask-1.6.2/ef-quill-1.6.2/ef-select2-1.6.2/ef-selectize-1.6.2/ef-title-1.6.2/fc-3.2.2/fh-3.1.2/kt-2.2.1/r-2.1.1/rg-1.0.0/rr-1.2.0/sc-1.4.2/se-1.2.2/datatables.min.js">
    

    Much of this is out of date but simply updating the whole link to the latest doesn't work either. Is there an easy way of updating the above that will work?

  • allanallan Posts: 61,627Questions: 1Answers: 10,090 Site admin
    Answer ✓

    First thing to do is check that the action parameter being sent to the server is create. Is it? You can check in the Network panel of your browser's inspector.

    Much of this is out of date but simply updating the whole link to the latest doesn't work either. Is there an easy way of updating the above that will work?

    The Editor plug-ins aren't available on the CDN any more I'm afraid.

    Allan

  • gordonc200gordonc200 Posts: 39Questions: 7Answers: 0

    HI Allan

    The action parameter is edit which is the problem.

    I'll target my own server instead of the CDN. Hopefully that will sort it.

  • allanallan Posts: 61,627Questions: 1Answers: 10,090 Site admin
    Answer ✓

    Worth updating your Editor instance as well if you haven't updated recently. mode() as a setter was 1.7+.

    Allan

  • gordonc200gordonc200 Posts: 39Questions: 7Answers: 0

    Yup. Basically my whole library was out of date. All updated now and works.

    Many thanks.

This discussion has been closed.