私のコードでこの問題を指摘してください。なぜドロップダウン選択項目が表示されないのですか?私はngTable Exampleに行きました、それは私にすべての詳細を与えていませんでした。私はソースngTableDemos
を見つけることができないので、私はfilterData
が正確に何であるべきか分からず、私の推測で作られています。ng-table filterDataが機能しない
"use strict";
angular.module('myApp', ['ngTable']).controller("myCtrl", ['NgTableParams', function (NgTableParams) {
this.cols = [
{field: 'name', title: 'Name', filter: {name: 'text'}},
{field: 'age', title: 'Age', filter: {age: 'number'}},
{field: 'gender', title: 'Gender', filter: {gender: 'select'}, filterData: ['male', 'female', 'shemale']}
];
this.tbParams = new NgTableParams({}, {
dataset: [
{name:'abc1001',age:11,gender:'male'},
{name:'abc1002',age:12,gender:'female'},
{name:'abc1003',age:13,gender:'shemale'}
]
});
}]);
<!DOCTYPE html>
<html ng-app="myApp">
<head lang="en">
<title>demo23</title>
<meta charset="utf-8">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.6/angular.js"></script>
<script type="text/javascript" src="https://unpkg.com/[email protected]/bundles/ng-table.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/bundles/ng-table.min.css" />
</head>
<body>
<div class="container-fluid" ng-controller = "myCtrl as ctrl">
<table ng-table-dynamic="ctrl.tbParams with ctrl.cols" class="table table-condensed table-bordered table-striped">
<tr ng-repeat="row in $data">
<td ng-repeat="col in $columns" >{{row[col.field]}}</td>
</tr>
</table>
</div>
</body>
</html>