EloquentStudio / filter.js

Complete solution for client side filtering and rendering using JSON data
http://eloquentstudio.github.io/filter.js
MIT License
665 stars 183 forks source link

Does not filter value from checkbox when JSON data contains white spaces #144

Open pooja-mane opened 7 years ago

pooja-mane commented 7 years ago

I try to filter my view from checkbox with options as: This is skill list

I have used this in coffee script code FJS = FilterJS(user_data.data, '#result-set', { template: '#result-row', criterias: [ {field: 'search_skill_list.$subset', ele: '#skills input:checkbox, #moreSkills input:checkbox'} ]});

when I want to filter out Fast Learner from JSON data it won't. JSON data contains that word,but it has a space as " Fast Learner" so it wont match with current data. It searches for exact word matching.

I tried for other examples also it gives same result as "no data is found".

Do you have any idea for this?

jiren commented 7 years ago

For a filtering, you need exact data in JSON and HTML inputs. One thing you can do is add beforeAddRecords callback to process data to remove spaces or unwanted things.

pooja-mane commented 7 years ago

Right now I have write a code inFilterJS function where we pass a json data, criteria.

pooja-mane commented 7 years ago

It works for all criteria. is it a right way?

jiren commented 7 years ago

If you are changing collected data from HTML then better you can render with a correct format. Use beforeAddRecords only for JSON data.

pooja-mane commented 7 years ago

I have to remove white spaces from only JSON data. I will try beforeAddRecords for that. Thank you...