Sub buttons in the angular dataTables

1

I'm using the DataTable plugin ( link ). You need to make the export buttons to be subitems, where there will be an export icon and clicking this will list (below) the options (CSV, PRINT, XLS).

The code I'm using is below but the subitems do not work, but the main button does.

$scope.dtOptions = DTOptionsBuilder.newOptions()
            .withDOM('<"html5buttons"B>lTfgitp')
            .withButtons([
                'copy',
                'print', 
                {'sExtends': 'collection',
                 'sButtonText': 'Save',
                 'aButtons': ['csv', 'xls', 'pdf']
                }
            ])
            .withOption('info',false)
            .withOption('lengthChange',false);
    }

Thanks in advance for the help.

    
asked by anonymous 07.06.2016 / 21:53

1 answer

1

Here's how I solved:

$scope.dtOptions = DTOptionsBuilder.newOptions()
            .withLanguageSource('js/plugins/dataTables/pt.json')
            .withDOM('<"html5buttons"B>lTfgitp')
            .withButtons([
                { extend:'collection', text: '<i class="fa fa-download"></i>', buttons: ['copy', 'csv', ] }, 
                { text: '<i class="fa fa-cog"></i>' }
            ])
            .withOption('info',false)
            .withOption('lengthChange',false);
    }

Using withButtons , I added an object containing the extend 'Collection', text which is the displayed text and buttons where the subitems will be listed.

    
07.06.2016 / 22:35