Would like to put spinner indicator when i start pdfhtml5 and stop when complete
Would like to put spinner indicator when i start pdfhtml5 and stop when complete

Hi - I am using a spinner package to display a spining indicator when the pdf button is pressed. I can't seem to figure out how to get a call bak when it finishes. I tried to put the code in the exportoptions{format:footer} but it didn't get called and I am not sure when I do get that working, that it gets called at the right time. Is there a proper way to do this with action callbacks?
'''
{
extend: 'pdfHtml5',
customize: function(doc) {
//ensure doc.images exists
doc.images = doc.images || {};
//build dictionary
doc.images['checkMark'] = getBase64Image(checkMark);
//..add more images[xyz]=anotherDataUrl here
//when the content is <img src="myglyph.png">
//remove the text node and insert an image node
for (var i=1;i<doc.content[1].table.body.length;i++) {
if ( doc.content[1].table.body[i][1].text == 'true') {
//console.log('text of '+i+' row '+doc.content[1].table.body[i][1].text);
delete doc.content[1].table.body[i][1].text;
doc.content[1].table.body[i][1].image = 'checkMark';
}
else {
doc.content[1].table.body[i][1].text='';
}
}
doc.content[1].table.widths = [ '9%', '2%', '18%', '8%', '12%', '10%', '8%', '8%', '10%', '8%', '2%', '5%'];
var cols = [];
cols[0] = {text: 'Left part', alignment: 'left', margin:[20] };
cols[1] = {text: 'Right part', alignment: 'right', margin:[0,0,20] };
var objFooter = {};
objFooter['columns'] = cols;
doc['footer']=objFooter;
},
text: 'PDF',
title: 'Warner Pacific Insurance Services - Open Submissions Snapshot '+ currentDate,
orientation: 'landscape',
footer: true,
exportOptions: {
columns: ':visible' ,
format : {
header : function (mDataProp, columnIdx) {
spinner.spin(target);
//console.log('raw'+mDataProp);
var htmlText = '<span>' + mDataProp + '</span>';
var jHtmlObject = jQuery(htmlText);
jHtmlObject.find('span').remove();
jHtmlObject.find('option').remove();
var newHtml = jHtmlObject.text();
console.log('My header for col: '+columnIdx+' > ' + newHtml);
if(columnIdx == 19) return 'U R G';
if(columnIdx == 7) return 'Group Name';
if(columnIdx == 8) return 'Policy Eff Date';
if(columnIdx == 10) return 'Status';
if(columnIdx == 14) return 'Case Advocate';
if(columnIdx == 16) return '# E N R';
return newHtml;
},
footer: function(mDataProp, columnIdx) {
console.log('My footer for col: '+columnIdx+' > ' + newHtml);
spinner.stop();
},
},
columns: [/*0,*/ 1, /*2, 3, */ 19, /*4, 5, 6,*/ 7, 8, 9, 10, /*11,*/ 12, 13, 14, 15, 16, 17]
}
},
'''