sorting - AngularJS ng-table filter not working on nested fields -
i have problem filter in ng-table angularjs when use it, it's work
{{p.quantite}}, {{p.montant}}, {{p.date | date:'dd/mm/yyyy'}}
but not working others
{{p.produitespece.produitfamille.libelle}}, {{p.produitespece.libelle}},{{p.clientclient.libelle }}
this code:
show_vente.html
<div class="panel-body"> <h5 class="over-title margin-bottom-15" data-ng-init="displaydata()">liste <span class="text-bold">des ventes</span></h5> <div> <table ng-table="tableparams" show-filter="true" class="table table-striped"> <tr ng-repeat="p in $data"> <td title="'famille'" filter="{ 'famille': 'text' }" > {{p.produitespece.produitfamille.libelle}} </td> <td title="'produit'" filter="{ 'produit': 'text' }" > {{p.produitespece.libelle}} </td> <td title="'quantité'" filter="{ 'quantite': 'text' }" >{{p.quantite}}</td> <td title="'montant'" filter="{ 'montant': 'text' }" >{{p.montant}}</td> <td title="'client'" filter="{ 'client': 'text' }" >{{p.clientclient.libelle }}</td> <td title="'date'" filter="{ 'date': 'text' }">{{p.date | date:'dd/mm/yyyy'}}</td> </tr> </table> </div> </div>
ventecontroller.js
var tabledata = []; $scope.filter = { key: undefined, failed: undefined }; $scope.tableparams = new ngtableparams({ page: 1, count: 25, },{ dataset: tabledata, total:tabledata.length, getdata : function($defer,params){ $http.get(prod.url+'/vente/all').then(function(response) { tabledata = response.data; tabledata = params.filter() ? $filter('filter')(tabledata, params.filter()) : tabledata; $defer.resolve(tabledata.slice((params.page() - 1) * params.count(), params.page() * params.count())); params.total(tabledata.length); }); } })
also sorting work "montant" , "quantite" , not working others
help please
thanks in advance
update
i found solution of problem, did create own filter:
filter="{ 'client': 'clienttext' }"
...
<script type="text/ng-template" id="ng-table/filters/clienttext.html"> <input type="text" name="filter-clienttext" ng-model="params.filter().clientclient.libelle" class="input-filter form-control"/> </script>
thanks :)
Comments
Post a Comment