我在Angular中有一个应用程序。在使用ui-grid的应用程序中,并希望对每列进行过滤。 我已经搜索了整个表格,并且它已经完成了。有我的HTML:
<div class="col-md-12" ng-controller="FlatController as flat">
<div class="search-wrapper">
<div class="search-box">
<input type="text" class="form-control" ng-model="flat.searchText" ng-change="flat.refreshData()" placeholder="Search...">
</div>
</div>
<div class="ui-grid-wrapper">
<div ui-grid="flat.gridOptions" ui-grid-resize-columns ui-grid-auto-resize id="grid1" class="grid"></div>
</div>
</div>
这是我的控制者:
angular.module('flatCtrl', ['flatService', 'ngTouch', 'ui.grid', 'ui.grid.resizeColumns', 'ui.grid.moveColumns', 'ui.grid.autoResize', 'ngSanitize', 'ui.select', 'ui.date'])
.controller('FlatController', ['Flat', 'socketio', '$filter', function(Flat, socketio, $filter){
vm = this;
Flat.allFlat()
.success(function(data){
vm.flats = data;
vm.gridOptions = {
data: data,
columnDefs: [
{field: 'id', displayName: 'Id', visible: false},
{field: 'creator', displayName: 'Creator', visible: false},
{field: 'typelocal', displayName: 'Typ lokalu', visible: true},
{field: 'country', displayName: 'Kraj', visible: true},
{field: 'city', displayName: 'Miejscowość', visible: true},
{field: 'district', displayName: 'Dzielnica', visible: true}
]
};
vm.refreshData = function() {
vm.gridOptions.data = $filter('filter')(vm.flats, vm.searchText, undefined);
};
});
也许谁知道如何在我的html中为每个ui-grid列添加输入?