Tablesorter不适用于新添加的项目

时间:2013-11-03 01:38:36

标签: jquery html tablesorter x-editable

在下面的页面中: http://homecoders.co.nf/test.html

我们正在使用TableSorter,QuickSearch,X-Editable。

TableSorter和QuickSearch正常运行,但新添加的项目除外。 例如,尝试单击“启用编辑”,添加项目,然后单击“禁用编辑”

新项目(无论你键入什么)都可以搜索,但不会被TableSorter排序。

仅供参考,JSFiddle无法使用此特定页面,所以我决定将页面放在托管中而不是它。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:2)

我不知道在哪里添加这个,因为我之前从未使用过X-Editable,但可能在成功回调中?

基本上,你需要更新表,如果它是一个小表,那么只需触发更新:

$('table').trigger('update');

在大型表格上,更新已编辑的单元格会更有效率

// update the table, so the tablesorter plugin can update its value
// this = table cell (td) to update
// resort = flag prevent (if false only) automatic resort
// if resort is undefined, or with any other value, a resort will occur
// callback = callback function
$("table").trigger("updateCell", [this, resort, callback]);
相关问题