在我的JQuery數據表中,row.add
不起作用,並引發錯誤說add函數是未定義的。該錯誤消息是:將行添加到jQuery中的數據表的功能給TypeError
Uncaught TypeError: Cannot read property 'add' of undefined
HTML
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</tfoot>
</table>
<button id="addRow">Add new row</button>
的javascript
$(document).ready(function() {
var counter = 1;
var prntTable = $('#example').dataTable({
"aoColumns" : [
{"bSearchable" : false},
{"bSearchable" : true},
{"bSearchable" : true}
],
"sPaginationType" : "full_numbers"
});
$('#addRow').on('click', function() {
prntTable.row.add([
counter +'.1',
counter +'.2',
counter +'.3'
]).draw();
counter++;
});
$('#addRow').click();
});
我得到錯誤遺漏的類型錯誤:無法讀取屬性未定義 – 2014-11-25 06:36:21
「添加」小提琴工作正常me..Have你檢查了它..?? – Outlooker 2014-11-25 06:38:17
是的小提琴工作正常.. – 2014-11-25 06:39:35