我有2个名为 player 和 team 的按钮。当我单击播放器按钮并单击bootstrap pdf按钮时,它将正常工作,但是当我单击 team 并单击pdf按钮时,它将出现以下错误:>
未捕获的TypeError:无法读取未定义的属性'0'
在Object.customize(showstats:940)
at u.action (buttons.html5.min.js:25) at r (dataTables.buttons.min.js:13) at HTMLAnchorElement.<anonymous> (dataTables.buttons.min.js:13)
在HTMLAnchorElement.dispatch(jquery.js:7630)
at HTMLAnchorElement.r.handle (jquery.js:7307)
Code:
{
extend: 'pdf',
title: value,
pageSize: 'LEGAL',
orientation: 'landscape',
exportOptions: {columns: [ 0,1,2,3,4,5,6,7,8]},
customize : function(doc) {
doc.content[1].table.widths = [ '11.12%', '11.11%', '11.11%', '11.11%', '11.11%', '11.11%', '11.11%', '11.11%', '11.11%'];
var rowCount = document.getElementById("statsPlayersList").rows.length;
for (i = 0; i <= rowCount; i++) {
doc.content[1].table.body[i][0].alignment = 'justify';
doc.content[1].table.body[i][1].alignment = 'center';
doc.content[1].table.body[i][2].alignment = 'center';
doc.content[1].table.body[i][3].alignment = 'center';
doc.content[1].table.body[i][4].alignment = 'center';
doc.content[1].table.body[i][5].alignment = 'center';
doc.content[1].table.body[i][6].alignment = 'center';
doc.content[1].table.body[i][7].alignment = 'center';
doc.content[1].table.body[i][8].alignment = 'center';
};
},