0

以下の静的な例では、名の並べ替えがありますが、メール列の並べ替えは無効になっています。

<tr>
    <th st-sort="firstName">first name</th>
    <th>email</th>
</tr>

しかし、私の列は動的です。だから私は動的な列ヘッダーをng-repeat. 列をソート可能にするかどうかは、isSortableフラグによって決定されます。

     <tr>
        <th st-sort="column.isSortable" ng-repeat="column in columns">{{column.columnName}}</th>
    </tr>

ソート可能にisSortable設定された列のみを作成するにはどうすればよいですか?true

4

1 に答える 1

-1

内部要素に st-sort を設定することをお勧めします

   <tr>
    <th ng-repeat="column in columns"><span st-sort="column.sortProperty" ng-if="column.isSortable">{{column.columnName}}</span><span ng-if="!column.isSortable">{{column.columnName}}</span></th></tr>

繰り返したくない場合は、このロジックをディレクティブに埋め込むことができます

于 2015-06-25T05:12:50.047 に答える