Enable the Disabled fields when using the Duplicate button
Enable the Disabled fields when using the Duplicate button
Hi,
I am using the duplicate functionality as shown https://editor.datatables.net/examples/api/duplicateButton.html
everything works fine, accept
in my "initEdit" event I have disabled a few fields which I want to enable when I click the duplicate button.
Currently the data is properly filled in the form but some fields are disabled.
Sample code
btns.push({
extend: "selected",
text: 'Copy',
action: function ( e, dt, node, config ) {
// Start in edit mode, and then change to create
editor
.edit( table.rows( {selected: true} ).indexes(), {
title: 'Create New sauda',
buttons: 'Create'
})
.mode( 'create' );
}
});
Also, I only want to copy a few fields and not all the fields in the form, is there any elegant way / callbacks for achieving the same.
Regards
This question has an accepted answers - jump to answer
Answers
Using
enable()
is probably the easiest option here. Just add.enable( [ ... fieldsToEnable ... ] )
to youreditor
chain.Allan
As always.. thanks a lot allan..