I have a problem with filter in ng-table AngularJS when I use it, it's work for
{{p.quantite}}, {{p.montant}}, {{p.date | date:'dd/MM/yyyy'}}
but not working for others
{{p.produitEspece.produitFamille.libelle}}, {{p.produitEspece.libelle}},{{p.clientClient.libelle }}
this my 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 just for "montant" and "quantite" and not working for others
help please
thanks in advance
Update
I found the solution of my problem, I did create my 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 :)