Disable remove and update button

Disable remove and update button

azonekz@gmail.comazonekz@gmail.com Posts: 32Questions: 9Answers: 1

Hi!
Is it possible to disable remove and update button when I select row?
It enables when I select row, but I need it disabled for some rows.
I have used https://datatables.net/reference/api/button().disable() but it not worked for me.
Thanks in advance

Answers

  • Rob BrunRob Brun Posts: 56Questions: 2Answers: 14

    Hi azonekz@gmail.com, can you confirm that you have assigned the name property to your edit and remove buttons? For example:

    buttons:[
      { extend: "create", editor: editor, name:"create" },
      { extend: "edit", editor: editor, name:"edit" },
      { extend: "remove", editor: editor, name:"remove" }
    ]
    
  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    Is it possible to disable remove and update button when I select row?

    You'd need to use a custom button for this. Specifically, in the button's buttons.buttons.init function add a listener for the select and deselect events. You can then decide in that function if you want to make the button active or not.

    The builtin button types in Editor for edit and delete extend the selected button, which is defined here. You could use that as the basis for your own init function.

    Allan

This discussion has been closed.