Wrong buttons showing, first button set defined is showing.

Wrong buttons showing, first button set defined is showing.

scottjacksonburrowsscottjacksonburrows Posts: 4Questions: 2Answers: 0

Using
JQuery 3.6.0
Datatables 1.13.2.
Buttons 2.3.4

I have two sets of buttons defined.

I make them visible by attaching them to a div called "toolbar" that is attached to the table via:
tbView.buttons( 'btnViewData:name' ).container().appendTo("div.toolbar");

Notice the name of the button group "btnViewData".

For this question I only append one set. You can see in the attached jsFiddle that the wrong set appears.

I'm not even calling the other set. The Add, Edit, and Delete buttons should not be showing.

For some reason only the first set of buttons defined is showing at all. And if you notice the
button set that I attached first is not showing at all. I get no errors reported just one set shows
and its not the first one that I appended.

It appears to be displaying the first thing after the div.

https://jsfiddle.net/scottjburrows/wLqcdnop/46/

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin

    Agreed - there is something going wrong here. Thanks for the test case - I'll look into it and get back to you, hopefully tomorrow.

    Allan

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    Answer ✓

    I've realised what is going wrong here. It is a little bit of confusion between buttons.buttons.name and buttons.name (poor naming on my part really).

    The first is a name for the button so it can be referenced. The second is a name for the group. In this case you want the second, but it is the first that was being used.

    I've updated your example here: https://jsfiddle.net/t4h02dq9/ . Both button sets are now being added to the table.

    Allan

  • scottjacksonburrowsscottjacksonburrows Posts: 4Questions: 2Answers: 0

    Thank you Allan.

Sign In or Register to comment.