EXPORT DATA FROM A HTML TABLE WITH PAGE TO EXCEL

0

I have this function to export data from a table that has pagination with Datatables, and it only exports me the view of the table and not all the columns.

function exportGrid(tableid,filename) {
		 var table= document.getElementById(tableid);
		 $("table tr td:last-child").replaceWith("");
		 var html = table.outerHTML;
		 var a = document.createElement('a');
  		a.id = 'ExcelDL';
		a.href = 'data:application/vnd.ms-excel,' + encodeURIComponent(html);
  		a.download = filename + ".xls";
  		document.body.appendChild(a);
  		a.click(); 
  	    location.reload();
  		document.getElementById('ExcelDL').remove();
		}
  	
    
asked by omar chavez 22.02.2018 в 23:44
source

0 answers