How can I enable/disable custom button in editor

How can I enable/disable custom button in editor

5320835@qq.com5320835@qq.com Posts: 15Questions: 5Answers: 0

Hi Allan,

I created a couple of custom buttons in Editor of create/edit form, for instance there is a button to save and another to approve.

My question is how can I disable 'approve' button before I save data and enable it after saved data, I checked two reference link below as well as in forums.

https://editor.datatables.net/reference/api/buttons

https://editor.datatables.net/reference/type/button-options

Can you give me some clue?

Thanks,
Wenbin

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin
    Answer ✓

    The only method in Editor to control the buttons is the buttons() method. And there isn't really a way to disable a button specifically other than to remove it. That might an option for you.

    Alternatively, what you could perhaps do is use buttons() to create both buttons again but have the approve button with a disabled class and no action on its fn callback.

    Allan

This discussion has been closed.