的数据后,我有它用了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'的页面?我的意思是如果涉及任何服务器端处理? –