1
このplunkには、動的に作成された列を持つngTableがあります。列はソート可能でフィルタリング可能ですが、タイトルをクリックするとソートが機能せず、フィルタも機能しません。何か案は?ngTableで動的に作成した列をソートしてフィルタリングする
Javascriptを
var app = angular.module('app', ['ngTable']);
app.controller('myCtl', function($scope,NgTableParams) {
$scope.cols = [
{nm:'uid', title:'User ID', sortable: 'uid', filter:{uid: 'text'}},
{nm:'ugr', title: 'Group ID', sortable: 'ugr',filter:{ugr: 'text'}}
];
$scope.data = [
{ uid: 'aaa',ugr: '222'},
{ uid: 'bbb', ugr: '111'}
];
$scope.tableParams = new NgTableParams({dataset: $scope.data});
});
HTML
<div ng-controller="myCtl" ng-app="app">
<table ng-table-dynamic="tableParams with cols" show-filter="true" class="table table-bordered table-hover">
<tr ng-repeat="row in data">
<td ng-repeat="col in cols">{{row[col.nm]}}</td>
</tr>
</table>
</div>
http://ng-table.com/#/sorting/demo-sorting-basic –
これを見ますこれは、デモでは、列が動的に作成されていないように私を助けていない – ps0604