2015-06-12 78 views
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的colums設置爲true排序?

回答

-1

我建議你設置你的ST-排序的內部元件

<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> 

,如果你不想重複自己,你可以在指令

+0

中嵌入這個邏輯上這是不是一個好稱呼。如果我的html在th元素內生長會怎樣? – Nitul