How to make the " NEW "button inactive initially.

How to make the " NEW "button inactive initially.

ostmalostmal Posts: 102Questions: 33Answers: 0

How to make the " NEW "button inactive initially.
I've been trying to do a small task for two hours now – it doesn't work. I need to make the "NEW" button inactive INITIALLY. But it became active when selecting a line.
I looked here, tried it in different ways, and it didn't work out:
https://datatables.net/extensions/buttons/examples/api/enable.html
https://datatables.net/forums/discussion/53387/enable-button-only-if-row-is-selected-and-a-column-has-a-defined-value
https://datatables.net/forums/discussion/55871/enable-button-on-row-select
I will be grateful for your help.

Answers

  • kthorngrenkthorngren Posts: 20,275Questions: 26Answers: 4,765

    Use the buttons.buttons.enabled to set the initial state. Then use something like the first example you linked to change the state based on selected rows.

    Kevin

  • ostmalostmal Posts: 102Questions: 33Answers: 0

    Thank you, I understand. Tell me, how do I access the "NEW" ("Create") button?

  • kthorngrenkthorngren Posts: 20,275Questions: 26Answers: 4,765

    Take a look at the button() API docs to see how to access the buttons.

    Kevin

  • ostmalostmal Posts: 102Questions: 33Answers: 0

    thanks

Sign In or Register to comment.