Jquery 表排序器:排序后更新行号

Jquery 表排序器:排序后更新行号,jquery,sorting,tablesorter,Jquery,Sorting,Tablesorter,我有一张有桌子的桌子。 因此,如果我对表进行排序,行号不会更新。它是固定的 $("#tablesorter-demo tr").click(function () { $('#tablesorter-demo tr').not(this).removeClass('hilite'); $(this).toggleClass('hilite'); var i = $("#tablesorter-demo tr").index(this); $("#codefmeni

我有一张有桌子的桌子。 因此,如果我对表进行排序,行号不会更新。它是固定的

$("#tablesorter-demo tr").click(function () {
    $('#tablesorter-demo tr').not(this).removeClass('hilite');
    $(this).toggleClass('hilite');
    var i = $("#tablesorter-demo tr").index(this);
    $("#codefmenims_id").val($("#td_idfmenims" + i + "").text());
    $("#groupe1").val($("#td_gpefme" + i + "").text());
    $("#groupe1s").val($("#td_gpenims" + i + "").text());
});
如果我对表格进行排序,有人能告诉我如何更新表格的行号吗

$("#tablesorter-demo tr").each(function(key) {
    $(this).children('td').eq(0).text(key+1);
});
请添加一个JSFIDLE,以便我发布更好的解决方案。

好的,您可以在这里看到它。。示例:因此,如果单击第1行,您将在输入中获得该行的信息。。如果在单击示例Organime的标题时对表格进行排序,并单击排序表格的第一行,则在排序之前,您将获得表格的信息,可能与~有关,请参见