-
Notifications
You must be signed in to change notification settings - Fork 182
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
Update filter.js #91
base: master
Are you sure you want to change the base?
Update filter.js #91
Conversation
Ability to add an order by toggle linking into the json query. FJS.addOrder({ ele: '#idoforderby'}); expects the orderby as the value in option as jsonfield|direction e.g. price|asc Also added support for multiple values in an input e.g.: <input value="1,2,3" Lastly, added if no value pass a highly unlikely value to the filter. This will ensure that when nothing is sent to the filter instead of showing all, nothing is shown.
Added the ability to use the like in json_query. This also allows for the AND search when adding filters. Example: FJS.addCriteria({field: 'feature', ele: '#featurewrap input:checkbox', type: 'like'}); <div id="featurewrap"> <input type="checkbox" name="feature" value="m_2403" >Value 1 <input type="checkbox" name="feature" value="m_2001" >Value 2 </div> if the first is clicked value m_2403 must be in the feature property of the JSON. if the second is clicked as well then using regex both must be present. Works only with strings
Hi Jiren, |
@jiren not sure how active you are on this project but sorting in filter.js natively would be fantastic. |
Sure I will add it. |
That would be fantastic :-) |
I've been using this as well in my current implementation of this library. Would you kindly merge this, @jiren? |
@ctwjowen, this update is incredibly helpful. Any insight on sorting by multiple columns in one select option? Or having an option that let's the default sorting from the db take precedence? |
@jiren Can we get this merged please? |
Hi Jiren,
Very new to all of his so hopefully i haven't stuffed this up. I have added in the below Pull request:
Ability to add an order by toggle linking into the json query.
FJS.addOrder({ ele: '#idoforderby'});
expects the orderby as the value in option as jsonfield|direction e.g. price|asc
Also added support for multiple values in an input e.g.: <input value="1,2,3"
Lastly, added at line 1174, if no value pass a highly unlikely value to the filter. This will ensure that when nothing is sent to the filter instead of showing all, nothing is shown.
Would welcome your feedback.
Thanks
J