我看過this question,解決方案非常簡單,但this plunker似乎不適用於我在項目中使用的Angular 1.33。ngTable嵌套字段
這裏是the same plunker與問題(只更新的Angular版本1.33)。
的Html
<table ng-table="tableParams" show-filter="true" class="table">
<tr class='listing' ng-repeat="invoice in $data">
<td data-title="'Invoice No.'" sortable="'no'" filter="{'no':'text'}">
{{invoice.no}}
</td>
<td data-title="'Date'" sortable="'date'" filter="{'date':'text'}">
{{invoice.date}}
</td>
<td data-title="'Client'" sortable="'client.fullname'" filter="{'client.fullname':'text'}">
{{invoice.client.fullname}}
</td>
</tr>
</table>
如果從過濾器去除.fullname它會使用所有對象(我的屬性認爲)哪些工作。會導致你其他問題嗎? – DoctorMick 2014-11-24 13:46:00
@DoctorMick我知道......但我需要'full_name'列可以排序,不僅可以搜索...如果我刪除了屬性,我將無法搜索'用戶'嵌套對象中的多個字段。 – 2014-11-24 13:48:34
它看起來像過濾器語法已更改爲使用適當的JSON表示法:https://github.com/angular/angular.js/issues/6222。我的猜測是ngTable沒有相應地更新。 – DoctorMick 2014-11-24 14:04:13