how to control multi button group in doms?

how to control multi button group in doms?

jadehanjadehan Posts: 4Questions: 2Answers: 0
edited September 2019 in Free community support

https://datatables.net/examples/basic_init/dom.html is useful to me, but i have one question

'B' is button group in dom. but another button group is...... ummm...

because i add one more button group using this code


new $.fn.dataTable.Buttons(theTable, {
    buttons: [
            {
                text: 'Button 2',
                action: function (e, dt, node, conf) {
                    alert('Button 2 clicked on');
                }
            },
            {
                text: 'Button 3',
                action: function (e, dt, node, conf) {
                    alert('Button 3 clicked on');
                }
            }
        ]
    });

    theTable.buttons(1, null).container().appendTo(
        theTable.table().container()
    );

and i change dom (dom: "Blfrtip") -> (dom: "BlfrtipB")

but same button group expose twice.....

is there any solution?

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    Hi @jadehan ,

    'B' only needs to go there once, so by default they're all grouped together. If you want to place them separately, you can do something like this.

    Cheers,

    Colin

  • jadehanjadehan Posts: 4Questions: 2Answers: 0
    edited September 2019

    hi @colin, thank you:)

    but i have one more question

    i want 2 button groups change location like (button group1) (search input) (button group2)

    I want 2 button groups and button group location change...

    I try buttons(0, null) or buttons(1, null) but button groups located in a strange place...

  • colincolin Posts: 15,144Questions: 1Answers: 2,586
    Answer ✓

    Hi @jadehan ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • jadehanjadehan Posts: 4Questions: 2Answers: 0

    @colin Thank you for your kind advice!

    I create a test case this link

    in my test case, second button group is under the datatables, but I want it show next to show 10 entries like this. :)

    thank you Colin!

  • colincolin Posts: 15,144Questions: 1Answers: 2,586
    Answer ✓

    Hi @jadehan ,

    This looks like it's doing what you want: http://live.datatables.net/tepecani/4/edit

    Cheers,

    Colin

This discussion has been closed.