1
我想將JSON數據添加到現有的數據表。將JSON數據添加到數據表中
的JSON數據是這樣的:
[
["Trident","Internet Explorer 4.0","Win 95+","4","X","X"],
["Trident","Internet Explorer 4.0","Win 95+","4","X","X"],
["Trident","Internet Explorer 4.0","Win 95+","4","X","X"],
["Trident","Internet Explorer 4.0","Win 95+","4","X","X"]
]
我想:
$('#' + tab + '_table').dataTable().fnAddData(data);
data
持有的JSON數據。
任何事情似乎是錯誤的,因爲有它增加了只有一個該行:
唉,謝謝。我認爲dataTables會這樣做。 – Michael
好的還有一個問題。我如何刪除現有的行?所以它不只是添加它們,而是先刪除舊的?謝謝 – Michael
使用'fnClearTable()'完全清空表,或'fnDeleteRow()'更具選擇性。詳細信息請參見DataTables的[API文檔](http://datatables.net/api) – 2014-01-19 01:34:57