的數據後,我有它用了jQuery插件數據表的表。該表的第一列實際上是正在使用渲染columndef選項選項,我的表initilisation如下面結合序列號。jQuery的數據表不更新,甚至改變每行
var myTable = $("#table_question").dataTable(
{
"columnDefs": [
{ "targets": 0, "render":
function (data, type, row,meta) { return String.format("<h4>{0}</h4>",row[4]) } },
{ "targets": [3, 4], "visible": false}],
"lengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
});
這裏是我的TR的HTML結構(煤礦是一個ASP.NET應用程序,以便包括EVAL有)
<tr questionid='<%# Eval("questionid")%>' questiontype='<%# Eval("questiontype")%>'>
<td class="col-md-1 col-xs-1 xol-sm-1">
</td>
<td class="col-md-7 col-sm-7 col-xs-7">
<%# Eval("question")%>
</td>
<td class="col-md-3 col-sm-3 col-xs-3">
<%# Eval("questionid")%>
</td>
<td>
<%# Eval("questiontype") %>
</td>
<td> <%# Eval("questionsequence")%></td>
</tr>
一切工作正常。序列號顯示正常。但是當我刪除一行時,我需要更新序列號。所以我嘗試迭代表格並更改Row數據。但是當我嘗試使用以下方法時,似乎沒有任何東西可以反映在桌面上。
var table = $('#table_question').DataTable();
table.rows().every(function (rowIdx, tableLoop, rowLoop) {
var row = this.data();
row[0]=7
row[4]=7;
});
table.draw(true);
此數據表中數據的變化(我認爲),但它沒有得到反映在桌子上
這是否反映了一旦你'refresh'的頁面?我的意思是如果涉及任何服務器端處理? –