Correct syntax when combining two button selectors

Correct syntax when combining two button selectors

kschlkschl Posts: 1Questions: 1Answers: 0

I would like to dynamically add a button to a collection using button().add() and button-selector. Button selector {\d}-{\d} works:

        table.button().add("0-7", {
            text: 'Button',
            action: function () {
            }
        });

But combining two button selectors {string}:name and {\d} fails:

        table.button().add("mybuttonname:name-7", {
            text: 'Button',
            action: function () {
            }
        });

TypeError: Cannot read properties of undefined (reading 'buttons')

What is the correct syntax?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 17,724Questions: 25Answers: 4,204
    Answer ✓

    According to the button-selector docs the {\d} and {\d}-{\d} expect integers. See the {\d} or {\d}-{\d} docs for details.

    I don't see an option in the docs to use a combo of name and index. I believe you can use button().index() with the mybuttonname:name selector then use that as the first index of {\d}-{\d}.

    Kevin

Sign In or Register to comment.