我正在尝试通过两个外部级联下拉列表在ngTable上获得过滤器支持。如文档所示,我已经更新了 filterOptions 但似乎没有运气。请帮我
$scope.tblInventory = new ngTableParams({
page: 1,
count: 10,
filter: $scope.searchObjs,
}, {
total: 0,
getData: function ($defer, params) {
inventoryService.getAllVehicles().then(function (data) {
params.total(data.length);
$defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));
});
}
});
我的 HTML 标记
<select class="form-control" id="make" name="make" data-ng-model="searchObj.make"
data-ng-disabled="!searchObj.makes"
ng-options="make for make in makes">
<option style="display:none" value="">Select a make</option>
</select>
<label>
Model
</label>
<select class="form-control" id="model" name="model" data-ng-model="searchObj.model"
data-ng-disabled="!searchObj.models"
ng-options="model for model in models">
<option style="display:none" value="">Select a model</option>
</select>
<table ng-table="tblInventory" class="table">
<tr ng-repeat="item in $data">
<td data-title="'Stock'">
{{item.stockNumber}}
</td>
<td data-title="'Make'">
{{item.make}}
</td>
<td data-title="'Model'">
{{item.model}}
</td>
</tr>
</table>