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

Update filter.js #91

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Update filter.js #91

wants to merge 3 commits into from

Conversation

ctwjowen
Copy link

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

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
@ctwjowen
Copy link
Author

Hi Jiren,
I added the ability to use LIKE as a filter. This gives the ability to use multiple regex and it works as an AND. E.g. if a value is in a string and value 2 is in the string as well, filter to show.
Thanks
J

@jer-tx
Copy link

jer-tx commented Jan 7, 2016

@jiren not sure how active you are on this project but sorting in filter.js natively would be fantastic.

@jiren
Copy link
Member

jiren commented Jan 8, 2016

Sure I will add it.

@bpuschl
Copy link

bpuschl commented Jan 8, 2016

That would be fantastic :-)

@grlindburg
Copy link

I've been using this as well in my current implementation of this library. Would you kindly merge this, @jiren?

@grlindburg
Copy link

@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?

@Acen
Copy link

Acen commented Jun 10, 2016

@jiren Can we get this merged please?
Specifically multiple values from the same input.

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

Successfully merging this pull request may close these issues.

6 participants