Direct duplicate a row (without opening the modal)

Direct duplicate a row (without opening the modal)

guidolsguidols Posts: 38Questions: 14Answers: 1
edited July 2022 in Editor

Hi,

I implemented the duplicate button. This opens a modal when duplicating a row.

How can I directly duplicate a row, without opening a modal?

Is it possible to duplicate multiple rows without a modal? e.g.: I select 3 rows, I press duplicate, and all the 3 rows are duplicated?

Thanks!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    edited July 2022 Answer ✓

    Yes, the edit() method can be told to not display the modal, and then call the submit() method - e.g.:

                        editor
                            .edit( table.rows( {selected: true} ).indexes(), false, {
                                title: 'Duplicate record',
                                buttons: 'Create from existing'
                            } )
                            .mode( 'create' )
                            .submit();
    

    Allan

  • guidolsguidols Posts: 38Questions: 14Answers: 1

    Thanks for the quick answer!

    I still see a little problem: if I select, let's say, 3 rows having different values and press "duplicate", the editor creates 3 news rows but all with the same values.

    Is there any possibility to duplicate multiple rows?

    If not, how can I disable the "duplicate" button if more than 1 rows are selected?

    Thanks!

Sign In or Register to comment.