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?
{
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
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
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.
It can be copying entrie row first then show the selected fields for editing.
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
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.
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