angularjs - How can I use a filter to all field in ng-table -
hi i'm learning angularjs, , i'm using ng-table, not know how multiple filter in 1 field.
i know how 1 filter , sorting, searched , read couldn't find working me, guess there way.
thanks , pardon english.
edit: thats code
$scope.init = function () { $http.post(slim + 'grupos2', $.extend({}, false, window.seguridad)).then(function(response) { $scope.grupos = response;
var data2 = $scope.grupos.data;
$scope.tableparams = new ngtableparams({ page: 1, count: 10, filter: { }, sorting: { nombre: 'asc' } }, { total: data2.length, getdata: function($defer, params) { var ordereddata = params.filter() ? $filter('filter')(data2, params.filter()) : data2; ordereddata = params.sorting() ? $filter('orderby')(ordereddata, params.orderby()) : ordereddata; $scope.grupete = ordereddata.slice((params.page() - 1) * params.count(), params.page() * params.count()); params.total(ordereddata.length); $defer.resolve($scope.grupete); } }); });
and
<tr ng-repeat="grupo in grupete"> <td data-title="'num'" sortable="'idgrupo'">{{grupo.idgrupo}}</td> <td data-title="'name'" sortable="'name'" filter="{ 'name': 'text' }" >{{grupo.nombre}}</td> <td data-title="'aforo'" sortable="'aforo'" >{{grupo.aforo}}</td> <td data-title="'fecha'" sortable="'fecha'" >{{grupo.fecha.tostring()}}</td> </tr> </table>
i want there filter searches multiple fields name.
filter="{ 'name': 'text' }"
the exact behaviour looking accomplished using filter object '$' attribute. this:
$scope.tableparams = new ngtableparams({ // ... filter: { $: 'filter string' }, }, { // ... });
Comments
Post a Comment