9

Angular と連携する JQuery tablesorter プラグインを使用しようとしています。現在、テーブルの幅と構造全体を並べ替えるために任意の列をクリックすると、ng-repeat 式を含む新しい行が作成されます。

$(document).ready(function() {
    $("#check").tablesorter();
});

 

<table id="check" class="table table-bordered table-striped table-condensed table-hover tablesorter" cellspacing="1">
    <thead>
        <tr>        
            <th class="header">Product Code#</th>
            <th class="header">Item Description#</th>
            <th class="header">Unit Cost#</th>
        </tr>
    </thead>
    <tbody>
        <tr ng:repeat="i in itemresponse" >
            <td><a href="#/ItemSearch/{{i._ItemID}}" >{{i._ItemID}}</a></td>
            <td>{{i.PrimaryInformation._ShortDescription}}</td>
            <td>{{i.PrimaryInformation._UnitCost}}</td>
        </tr>
    </tbody>
</table>
4

2 に答える 2

6

あなたはそれを間違っています。

AngularJS を使用してテーブル内の行を並べ替えたい場合は、orderByフィルターを使用する必要があります。別のフレームワークを含める必要はありません。その飛躍を遂げたら、オンライン (または SO) で多数のサンプルを見つけることができます。

たとえば、このフィドルを参照してください: http://jsfiddle.net/uRPSL/1/

于 2014-03-22T06:59:27.443 に答える