akveo / akveo/ng2-smart-table

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

Đang mở
#1,006 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
1.6k
Fork
867
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.