Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81729

Appending Buttons to existing dropdown

$
0
0

Hi.

I would like to append the contents of export Buttons menu to an existing dropdown on the page.

Current code:

 var exportBtn = new $.fn.dataTable.Buttons(table, {
        buttons: [{
            extend: 'collection',
            text: '<i class="mdi mdi-dots-horizontal mdi-icons-table"></i>',
            className: 'btn-fw-grey border-0 with-data-toggle',
            buttons: [{
                    text: '<div class="pt-3" style="text-transform: uppercase">exportieren</div>'
                },
                {
                    extend: 'copy',
                    text: '<a class="dropdown-item pl-0" href="#"><i class="mdi mdi-content-copy pr-2"></i>Kopieren</a>',

                },
                {
                    extend: 'pdf',
                    orientation: 'landscape',
                    pageSize: 'LEGAL',
                    text: '<a class="dropdown-item pl-0" href="#"><i class="mdi mdi-content-copy pr-2"></i>PDF</a>'
                },

                {
                    extend: 'excel',
                    text: '<a class="dropdown-item pl-0" href="#"><i class="mdi mdi-content-copy pr-2"></i>Excel</a>'
                }
            ]
        }]
    });

    exportBtn.container().appendTo(filterColumn);

Which comfortably places the export Buttons menu at a default position relative to the table.

What I would like now is something like:

    if(options.buttonsAt) exportBtn.ACTUAL_BUTTONS().appendTo($(options.buttonsAt));  // I'd like a call like this.
    else exportBtn.container().appendTo(filterColumn);

Can I get hold of the actual buttons as opposed to the dropdown toggle?
Or is there another solution to achieve the effect?


Viewing all articles
Browse latest Browse all 81729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>