do not show foot if there is more than one group
do not show foot if there is more than one group
silens
Posts: 101Questions: 40Answers: 0
I would like you to show me the value of the foot, only if there is a grouping. If there is more than one grouping, I do not want the package value to appear
"drawCallback": function (settings) {
var api = this.api();
var rows = api.rows({
page: 'current'
}).nodes();
var last = null;
api.column(0, {
page: 'current'
}).data().each(function (group, i) {
if (last !== group) {
$(rows).eq(i).before('<tr data-group="' + group + '" class="group"><td colspan="6"><b>' + group + '</b></td></tr>');
last = group;
}
});
},
"footerCallback": function (row, data, start, end, display) {//Aqui meto los subtatales y totales por pagina en el pie de la tabla
var api = this.api(),
data;
var intVal = function (i) {
return typeof i === 'string' ? i.replace(/[\€,]|Kg/g, '') * 1 : typeof i === 'number' ? i : 0;
};
bultos= api.column(2, {
page: 'current'
}).data().reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0);
$(api.column(2).footer()).html(bultos + '</font>');
},
This discussion has been closed.
Answers
Hi @silens ,
There's a lot of code there. We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. 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