Add My Own Collection Button to DataTable

Add My Own Collection Button to DataTable

namhungnamhung Posts: 2Questions: 2Answers: 0

Hi,

I am using a button collection which is extended from built-in html5 buttons.

var table = $('#tbMyLeaves').DataTable({
       ...
        buttons: [
            {
                extend: 'collection',
                text: 'Xuất Dữ Liệu',
                buttons: [
                    {
                        extend: 'csvHtml5',
                        title: 'Company Leaves',
                        exportOptions: {
                            columns: [5, 6, 7, 8, 9, 10, 23, 24]
                        }
                    },
                    {
                        extend: 'excelHtml5',
                        title: 'Company Leaves',
                        exportOptions: {
                            columns: [5, 6, 7, 8, 9, 10, 23, 24]
                        }
                    },
                    {
                        extend: 'pdfHtml5',
                        title: 'Company Leaves',
                        exportOptions: {
                            columns: [5, 6, 7, 8, 9, 10, 23, 24]
                        }
                    },
                    {
                        extend: 'copyHtml5',
                        text: 'Lưu Vào Bộ Nhớ Tạm',
                        exportOptions: {
                            columns: [5, 6, 7, 8, 9, 10, 23, 24]
                        }
                    },
                    {
                        extend: 'print',
                        text: 'In Tất Cả',
                        title: 'Company Leaves',
                        exportOptions: {
                            columns: [5, 6, 7, 8, 9, 10, 23, 24]
                        }
                    }
                ],
            }
        ],
        select: true
    });

Now, I want to add my own collection- a new button named "Actions" and when I click on it, the "ADD, DELETE,EDIT" buttons will be shown down.

Please help me to do that. Many thanks.

This discussion has been closed.