각도 ui 격자를 사용하는 동안 selectOptions를 사용하여 드롭 다운 옵션을 열 필터로 채 웁니다. 다음 코드와 비슷한 것 :각도 ui 격자 열 드롭 다운 필터 빈 옵션
angular.module('exampleApp', ['ui.grid'])
.controller('exampleCtrl', ['$scope', 'uiGridConstants', function($scope, uiGridConstants) {
var animals = [
{ id: 1, type: 'Mammal', name: 'Elephant' },
{ id: 2, type: 'Reptile', name: 'Turtle' },
{ id: 3, type: 'Mammal', name: 'Human' }
];
var animalTypes = [
{ value: 'Mammal', label: 'Mammal' },
{ value: 'Reptile', label: 'Reptile'}
];
$scope.animalGrid = {
enableFiltering: true,
columnDefs: [
{
name: 'type',
field: 'type',
filter: { selectOptions: animalTypes, type: uiGridConstants.filter.SELECT }
},
{ name: 'name', name: 'name'}
],
data: animals
};
}]);
<link href="http://ui-grid.info/release/ui-grid.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script src="http://ui-grid.info/release/ui-grid.js"></script>
<div ng-app="exampleApp">
<div ng-controller="exampleCtrl">
<h1>UI Grid Dropdown Filter Example</h1>
<div ui-grid="animalGrid" class="grid"></div>
</div>
</div>
여기에는 여분의 빈 옵션이있는 각 열의 드롭 다운 필터 옵션이 나와 있습니다. 빈/빈 옵션을 제거하거나 빈/빈 옵션을 '모두'텍스트로 바꾸려면 어떻게합니까?
좋아요, 단지 작은 일에 대한 this Fiddle를 참조하십시오 : 거기 아니다 귀하의 질문에 한 줄의 코드라도, 어떻게 도움을 줄 사람이 있습니까? –