Help Needed with SELECT
Help Needed with SELECT
HI, I can't enable the SELECT option. the FOOTER CALLBACK, and EXPORT options works propertly. Any clues with this?
Sorry about my english. I'm stll learnig.
Thankyou!
```$('#example').DataTable({
dom: 'Bfrtip',
select: true, <<<<<------ is this correct??
buttons: [
{
extend: 'excelHtml5', footer: true,
title: "Listado de Ventas",
exportOptions: {
columns: [ 0, 1,2, 3, 4, 5 ]
}
},
{
extend: 'pdfHtml5', footer: true,
title: "Listado de Ventas",
exportOptions: {
columns: [ 0, 1,2, 3, 4, 5 ]
}
},
{
extend: 'print', footer: true,
text: 'Print all',
exportOptions: {
modifier: {
selected: null
}
}
},
{
extend: 'print', footer: true,
text: 'Print selected'
}
],
"language": {
"lengthMenu": "Mostrar _MENU_ registros por pagina",
"zeroRecords": "No se encontraron resultados en su busqueda",
"searchPlaceholder": "Buscar registros",
"info": "Mostrando registros de _START_ al _END_ de un total de _TOTAL_ registros",
"infoEmpty": "No existen registros",
"infoFiltered": "(filtrado de un total de _MAX_ registros)",
"search": "Buscar:",
"paginate": {
"first": "Primero",
"last": "Último",
"next": "Siguiente",
"previous": "Anterior"
},
},
"footerCallback": function ( row, data, start, end, display ) {
var api = this.api(), data;
// Remove the formatting to get integer data for summation
var intVal = function ( i ) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '')*1 :
typeof i === 'number' ?
i : 0;
};
// Total over all pages
total = api
.column( 6 )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Total over this page
pageTotal = api
.column( 6, { page: 'current'} )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
// Update footer
$( api.column( 6 ).footer() ).html(
'$'+pageTotal +' ( $'+ total +' total)'
);
}
});```
This question has accepted answers - jump to:
Answers
Yes.
But you also need to be including the Select extension.
See the docs:
https://datatables.net/reference/option/select
Hi @FerchuS ,
If still no joy, 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
sorry I can't with this.
I've tried
select: true, {
style: 'multi+shift'
},
select: {
true,
style: 'multi+shift'
},
select: {
style: 'multi+shift'
},
none of them worked, I want to do multiselect.
may you give some more informaition?? Pls??
Thanks a lot!!
in the code of the of the example page it work with
var table = $('#example').DataTable( {
dom: 'Bfrtip',
select: true,
@colin wow!! what a usefull tools.. but unfortunately i'm still stacked!!
in live.datatables.net/jotadidi/1/edit i've tried my java code but it doesn't work. i don't know really what else to do. if you could help me I will be really gratefull!!
Hi @FerchuS ,
As @tangerine said, you weren't including all the necessary libraries - see fixed version here. If you look at the examples for Buttons, you can see the required CSS and JS files for each of them.
Cheers,
Colin
heyy @colin it works.. thankyou verrry much for your help!! the trouble was with the required files.. And to use the button to **print selected ** there are some extra file i need to add to my code?? i was looking the examples but i all ready have the scripts listed. Some ideas what else can I do?? Thankyou!!! ann sorry for the inconvenience
Hi @FerchuS ,
Yep, each button needs it's own specific files. The best bet is to look at the examples, such as this one here for print, and look at the "Javascript" and "CSS" tabs - it lists all the files you need.
Cheers,
Colin