Can I set to duplicate entire record when in Duplicate as I only have selected a few rows in edit?

Can I set to duplicate entire record when in Duplicate as I only have selected a few rows in edit?

wonglikwonglik Posts: 33Questions: 3Answers: 0
edited June 4 in Editor
{
    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');
    }
},

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Yep, that's possible. Your code looks like it was taken from this example. Is that not doing what you expected/want? And if so, could you provide more details, please, on what you expect to happen.

    Colin

  • wonglikwonglik Posts: 33Questions: 3Answers: 0

    I would ask if I can use the duplicate button to copy all the fields of the selected record but keep the editor only for selected fields editing.

  • wonglikwonglik Posts: 33Questions: 3Answers: 0

    It can be copying entrie row first then show the selected fields for editing.

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    I'd suggest you have two Editor instances for what you want. One configured with all of the fields you want to duplicate the value of, and the other configured with only the fields that you want to be editable.

    Allan

  • wonglikwonglik Posts: 33Questions: 3Answers: 0

    I actually would need a button to execute something like insert into file_to_be_edited select * from file_to_be_edited where sysid = (selected row sysid) then go into editor to edit the selected fields in the newly added record.

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Yup - totally possible to bypass Editor and send an Ajax request to run your SQL to duplicate the row. See this page for how to create a custom button.

    Allan

Sign In or Register to comment.