Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
devilking15292 opened this issue May 11, 2019 · 0 comments
Open

Comments

@devilking15292
Copy link

devilking15292 commented May 11, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant