【发布时间】:2015-08-31 14:54:09
【问题描述】:
我正在使用 mottie 的 tablesorter 插件和带有子行 child rows 的标准表。数据从mysql加载并存储在数组中。因为它是一个相当大的表,所以子行中的附加数据不会在表加载时生成。出于性能原因,仅在点击切换后才会显示生成的附加数据。
伪代码:
// the html
<thead>
<tr>
<th>Order #</th>
<th>Customer</th>
<th>PO</th>
<th>Date</th>
<th>Total</th>
</tr>
// the table sorter row, x is the increment var for iterating the array
"<tr><td>$data[x]['order']</td><td>$data[x]['customer']</td>...snip...</tr>"
// the toggle div, x = array increment var
$('.tablesorter').delegate('.toggle', 'click' ,function(){
var x = find...snip...attr('id');
var output = '<tr class="tablesorter-childRow">';
output += '<td><div id='+x+'><span class="editable" id="customer">'+$data[x]["customer"]+'</span></div></td>';
output += '</tr>';
$(this).closest('tr').nextUntil('tr:not(.tablesorter-childRow)').find('td').toggle().html(output);
return false;
});
这工作得很好。在附加数据中,有几个字段可由jeditable 编辑,将修改后的值保存到mysql 数据库和带有tablesorter 数据的数组。
编辑后 jeditable 在附加数据中显示编辑后的值,但父行(tablesorter,包含切换)显示旧值。是否有可能在不重新加载整个表的情况下从数组中刷新 tablesorter 中已编辑的行?因此,如果我在示例中编辑客户,它也应该显示在表格行中。
非常感谢!
编辑:我尝试了 $("#tstable").trigger("update"); 之类的东西,但不起作用
【问题讨论】:
标签: jquery tablesorter