Duplicate Button Problam

Duplicate Button Problam

eyal_hbeyal_hb Posts: 98Questions: 31Answers: 0

i create duplicate,edit and remove button like this:

{
                data: null,
                "orderable": false,
                className: "center",
                defaultContent: "<button class='btn btn-outline btn-success btn-sm editor_edit' style='border-radius: 40%;margin: auto;display: block'><i class='fas fa-pen' style='margin: 2px -2px 0px -1px;font-size:19px'></i></button>"

            },

            {
                data: null,
                className: "center",
                "orderable": false,
                defaultContent: "<button class='btn btn-outline btn-primary btn-primary btn-sm editor_duplicate' style='border-radius: 40%;margin: auto;display: block'><i class='fas fa-clone' style='margin: 2px -2px 0px -1px;font-size:19px'></i></button>"

            },
            {
                data: null,
                className: "center",
                "orderable": false,
                defaultContent: "<button class='btn btn-outline btn-primary btn-danger btn-sm editor_remove' style='border-radius: 40%;margin: auto;display: block'><i class='fas fa-trash-alt' style='margin: 2px -2px 0px -1px;font-size:19px'></i></button>"

            }

now i want to disable field only on edit mode, its work fine in create and edit mode, but in duplicate this disable also the field, how i can make the only on edit mode i will disable field, and all other mode include duplicate not?

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    I'm struggling to understand this, sorry. Could you link to your page or create a test case, please, that would help picture this.

    Colin

  • eyal_hbeyal_hb Posts: 98Questions: 31Answers: 0

    i just want to disable field in editor only in edit mode,
    but instead its happens when i also click on duplicate button

      editor.on('initEdit', function (n) {
            editor.disable('orderNumber');
        });
    
        editor.on('initCreate', function () {
            editor.enable('orderNumber');
        });
    
  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    The Duplicate, if based on this example, isan extension of Edit, so would trigger the same code. Probably the easiest thing to do is to set a flag/variable in the action function of that example, which you then check in your initEdit. You would then clear the flag/variable in the close.

    Colin

This discussion has been closed.