Enable the Disabled fields when using the Duplicate button

Enable the Disabled fields when using the Duplicate button

kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

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

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Using enable() is probably the easiest option here. Just add .enable( [ ... fieldsToEnable ... ] ) to your editor chain.

    Allan

  • kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

    As always.. thanks a lot allan..

This discussion has been closed.