akveo / akveo/ng2-smart-table

Stand Alone filter always return "No Data Found" on the first click

Ouverte
#1,006 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
1.6k
Forks
867
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I have been facing this bug,
if i give a stand-alone filter like this

`this.source.setFilter([`
` {`
` field: 'amount',`
` search: dateSearch,`
` filter: (value, dateSearch)=>{`
` return new Date(value) >= dateSearch;`
` }`
`], true, true)`

always return's empty (No Data Found) in the grid,
after deep debugging found the root cause in the file,

**ng2-smart-table/src/ng2-smart-table/components/filter/filter-default.ts**

` onFilter(query: string) {`
` this.source.addFilter({`
` field: this.column.id,`
` search: query,`
**filter: this.column.getFilterFunction(),**
` });`
` }`

this particular line
returns the filter from the **filterFunction** in the DataModel which we define to map the data.

which is not defined so my custom function is not executing, instead it runs the normal search and return's zero elements the data Array, saying

"No Data Found"

in the front-end.

so as a workaround, I have set the filter function this in the DataModel itself.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.