【发布时间】:2014-11-07 12:03:12
【问题描述】:
我想在表格的每一列中添加输入文本框,以根据相应的列搜索对表格进行过滤。
这是我的表格搜索行的 HTML 代码:
<tr>
<td ng-repeat="column in columns">
<div class="right-inner-addon">
<input type="text" class="form-control input-sm" ng-model="$parent.searchTableQuery.column.field">
</div>
</td>
</tr>
这是我的过滤器代码:
<tbody>
<tr ng-repeat="item in dataSource | filter:searchTableQuery | orderBy:predicate:reverse">
<td ng-repeat="key in getKeysOfCollection(item)">{{item[key]}}</td>
</tr>
</tbody>
但在这里我无法根据表格列搜索过滤表格。
我无法在搜索输入框中提供有效的 ng-model。
ng-model="$parent.searchTableQuery.$" is ng-model of table search input box.
更新
我已将我的问题更新至:http://plnkr.co/edit/5vjsRdRLTFgXhvqHVkWA?p=preview
在此问题中,搜索仅适用于 Id 列,不适用于任何其他列。
【问题讨论】: