Javascript 我希望在不破坏序列号列顺序的情况下对表进行排序(使用ng repeat,tablesort())

Javascript 我希望在不破坏序列号列顺序的情况下对表进行排序(使用ng repeat,tablesort()),javascript,html,jquery,Javascript,Html,Jquery,当我单击sort按钮时,没有任何列也会受到影响,这是它应该做的。我需要一个Sl No列,它将始终保持序列,即使在排序、删除和添加之后也是如此。(我正在使用索引号删除该行) 以下是我的演示html代码: <table id="mofiz" border="1"> <thead> <tr>

当我单击sort按钮时,没有任何列也会受到影响,这是它应该做的。我需要一个Sl No列,它将始终保持序列,即使在排序、删除和添加之后也是如此。(我正在使用索引号删除该行)

以下是我的演示html代码:

        <table id="mofiz" border="1">

                            <thead>

                                <tr>
                                    <th >Sl No</th>
                                    <th >Item Name</th>
                                    <th >Description </th>
                                    <th >Salary</th>
                                    
                                </tr>
                            </thead>
                            <tbody>

                                <tr ng-repeat="anItem in mockDataList" >
                                    <td>{{$index+ 1}}</td>

                                    <td style="text-align:center;">{{anItem.ItemName}} </td>
                                    <td style="text-align:center;">{{anItem.Description}} </td>
                                    <td style="text-align:center;">{{anItem.Salary}} </td>
                                    
 
                                </tr>
                            </tbody>
                            <tfoot>
                                <tr>
                                    
                                  
                                    
                                </tr>
                            </tfoot>
                            <!-- END OF DISABLE SECTION-->
                        </table>

你可以使用CSS计数器通过CSS实现。我还希望使用outterhtml获得sl值
    var App = angular.module('myApp', []);

function DataCtrl($scope, $http) {

$scope.mockDataList = 
[{ ItemName: "ItemName" , Description: "Description" ,  Salary: "Salary" },
{ ItemName: "ItemName1" ,  Description: "Description1" ,  Salary: "Salary1" },
{ ItemName: "ItemName2" ,  Description: "Description2" ,  Salary: "Salary2" },
{ ItemName: "ItemName3" , Description: "Description3" , Salary: "Salary3" }


];
       
    $("#sort").click(function () {
        $('#mofiz').tablesort();
    });


}