Correct syntax when combining two button selectors

Correct syntax when combining two button selectors

kschlkschl Posts: 3Questions: 3Answers: 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: 21,443Questions: 26Answers: 4,974
    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.