add a length menu using layout on datatable 2.1.5
add a length menu using layout on datatable 2.1.5

Hey guys! Everything fine?
I have a layout like that:
layout: {
topStart: {
buttons: [
{
extend: 'excel',
text: '<i class="fas fa-file-excel"></i> Excel',
attr: {
style: 'background-color: green; color: white;'
},
className: 'btn btn-success',
filename: function () {
const dataAtual = new Date();
const dia = dataAtual.getDate();
const mes = dataAtual.getMonth() + 1;
const diaFormatado = dia < 10 ? '0' + dia : dia;
const mesFormatado = mes < 10 ? '0' + mes : mes;
return Table + '-' + diaFormatado + '-' + mesFormatado + '-Example;
},
},
],
},
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
}
I can't add a length menu (inside and outsite the layout object). It's possible?
This discussion has been closed.
Answers
Where do you want it to appear? If next to the search, you could do:
If you want it on its own row above the table:
Or as a button next to the Excel one:
Or many more options. Have a look at this example.
Allan