Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is there any way to Ajax facets be integrate with a range slider?
Comment | File | Size | Author |
---|---|---|---|
#6 | 6BylMc6.png | 9.62 KB | eugene.ilyin |
Comments
Comment #1
nickBumgarner CreditAttribution: nickBumgarner commentedSubscribe
Comment #2
eugene.ilyin CreditAttribution: eugene.ilyin commentedComment #3
eugene.ilyin CreditAttribution: eugene.ilyin commentedBtw, I've started work on it. It' will work like https://jqueryui.com/slider/#range
I'll try to implement it in 1-2 weeks.
Comment #5
eugene.ilyin CreditAttribution: eugene.ilyin commentedI've commited new widget "Ajax ranges". Can somebody check it out?
Example:
Comment #6
eugene.ilyin CreditAttribution: eugene.ilyin commentedComment #7
eugene.ilyin CreditAttribution: eugene.ilyin commentedSo, it will be included into the next release, which I'm going to prepare in few weeks.
Comment #9
JamesDevware CreditAttribution: JamesDevware commentedGreat module thanks.
I had some issues with this while using this for a commerce product price slider.
In Drupal.ajax_facets.processSlider the facet name was not encoded resulting in colons in the facet name meaning that the slider didn't work.
I also wasn't getting live updates in the fields so added a few lines to make the fields update as the user was moving the slider. (This may be something to do with my setup, I haven't tested on a simpler build).
Below is the resulting processSlider function that worked for me. Hopefully this can help you to make this more robust and work with fields that are built through relationships.
Thanks again!
Comment #10
JamesDevware CreditAttribution: JamesDevware commentedComment #11
eugene.ilyin CreditAttribution: eugene.ilyin commented@Xenza, thank you for your report. But it looks strange. Please provide more info, how I can reproduce your problem.
Comment #12
JamesDevware CreditAttribution: JamesDevware commentedCommerce product is attached to a product display
Product displays are indexed in search api
Field:
Product > Price > Amount (decimal) | field_product:commerce_price:amount_decimal | Indexed as "Decimal"
AJAX Ranges Selected (This is the same setup which was used and worked for "Ranges Min/Max UI Slider")
Update via AJAX and selected "Empty Facet Behaviour"
Unfortunately this setup didn't work before I patched the JS.
There was also an issue with this setup and jQuery 1.8+ Which was with the decimals being passed to the jquery slider as strings rather than numeric values.
This was fixed with the below:
Comment #13
fmfpereira CreditAttribution: fmfpereira commentedI also have tried with a commerce price, and the problem is the same.
#9 also solved my problem for now.
Filipe
Comment #14
eugene.ilyin CreditAttribution: eugene.ilyin commentedComment #15
esiao CreditAttribution: esiao commentedI had the same problem and #9 solved my issue. But I had another,
While the search query was executed correctly, the range slider was reset to it's initial values. So the end user wasn't aware that the modifications were effective.
I solved it by doing a little internal caching.
I added a new object
And modified the ranges widget function attachement with the following
This is far from perfect as I think the best solution would be to change the "min-val" and "max-val" values on the slider when it gets recreated so in the ajax Callback done in the module file. And then in the Javascript initialize the slider with these values, instead of creating an object to store the values and retrieve them like I did.
If this can help.
Comment #16
esiao CreditAttribution: esiao commentedI had the same problem and #9 solved my issue. But I had another,
While the search query was executed correctly, the range slider was reset to it's initial values. So the end user wasn't aware that the modifications were effective.
I solved it by doing a little internal caching.
I added a new object
And modified the ranges widget function attachement with the following
This is far from perfect as I think the best solution would be to change the "min-val" and "max-val" values on the slider when it gets recreated so in the ajax Callback done in the module file. And then in the Javascript initialize the slider with these values, instead of creating an object to store the values and retrieve them after like I did.
If this can help.
Comment #18
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commentedI've applied some corrections. But not exactly as in the snippets of code above.
So ajax ranges works pretty good for me right now. With decimals also.
I don't want to make this issue too big. Please create new issues if you'll have some trouble.
P.S. @esiao
Your problem isn't fully clear for me. I don't understand how it happens that slider has been reset. Can you explain it please? Step by step approach is the best.
Comment #20
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commented@esiao ok, I'm closing this issue. If you still have a trouble please open the new one related with this.
Comment #21
dmitryVL CreditAttribution: dmitryVL at DEWEB Studio, Drupal Ukraine Community for Drupal Ukraine Community commentedHello
I need some help, how i can get ranges widget without updating max and min values after rebuild ? Maybe you can advise me some code edits on your module ?
Comment #22
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commentedThis issue is pretty long and old. Please create new one.