Comments (18)
I have been running into the same problem. Your workaround did not fix it for me but I discovered that if I add "method: :get" on my link_to for the page using smart_listing, it will load correctly.
<%= link_to 'Listing', listing_path, method: :get %>
from smart_listing.
Hello guys,
@ndelrossi: Are you saying that adding method: :get
to link_to
works around that problem? I think that this is default for link_to
...
from smart_listing.
Yeah it is the default so I am not sure why it works. Using this will work as well:
<%= link_to 'Listing', listing_path, data: { 'no-turbolink' => true } %>
Maybe the explicit request to use method: :get
also turns turbolinks off for that link. I am not sure but adding either causes smart_listing to correctly reload filter results for me.
from smart_listing.
Just tried it out: method: :get
really disables turbolink for the link, not sure if this is intended behavior or a rails bug.
@ndelrossi : Are you able to trace down why specifying an explicit href
isn't used at https://github.com/Sology/smart_listing/blob/master/lib/smart_listing.rb#L128 ?
from smart_listing.
I'm very new to rails/ruby so I'm having a hard time tracing this stuff down.
I did notice that if I change this code from:
ready ->
$('.<%= SmartListing.config.classes(:main) %>').smart_listing()
$('.<%= SmartListing.config.classes(:controls) %>').smart_listing_controls()
$(document).ready ready
$(document).on "page:load", ready
to be ready = ->
instead of ready ->
, the page will now update results. However I still have a problem when viewing in Firefox. The results update but never fade back in. Having trouble figuring that out.
from smart_listing.
ready ->
is definitely wrong (because it is compiled to ready(function(){...}))
, and has already be fixed in master: https://github.com/Sology/smart_listing/blob/master/app/assets/javascripts/smart_listing.coffee.erb#L390 .
from smart_listing.
@ndelrossi
Can't reproduce your issue. Tested it with Firefox 31.0 and Turbolinks 2.2.2. The test case were simply two pages: one with link to another and the second one with SmartListing. All seemed to work fine.
Can you provide some more details about your issue?
from smart_listing.
Used turbolinks 2.2.2 and master smart_listing (a084fb9). Still does not work correctly.
I have smart_listing on "/". If i open some other page and then go to "/" (by clicking on link), it will use old url for ajax requests.
P.S. Tested in safari
from smart_listing.
Same problem for me. Testing in Safari on Mac, Chrome on Windows and Chrome on Mac.
from smart_listing.
Some more info for @ljachymczyk: You need to use two pages with Smart Listing on them. e.g. /list1
and /list2
and one more root page /
. Each list should use same list structure but different data.
Each page needs to have standard links to all other pages, e.g. a menu.
- Go to root
- Click link for
/list1
. Make some AJAX request (e.g. search, paging, etc). Smart Listing works - Click link for
list2
. Make an AJAX request. Data from/list1
is retrieved via AJAX.
This should be enough to reproduce.
from smart_listing.
any news on it?
from smart_listing.
Is there any chance of this getting fixed? Or should we stop using this gem?
It's really useful but if it is not being maintained then it is better to roll-my-own
from smart_listing.
Hello @shaneog
We couldn't reproduce this issue on our own. Seems that everything works in our environments.
You could provide us with sample app where this problem occurs so we can work on it. I guess this is easier than rolling your own gem, right?
Waiting for your contribution & thanks.
from smart_listing.
Ah, ok. I did not realise you were waiting. I'll try to put a sample app together in the next few hours!
from smart_listing.
I did the following to get rid of this issue:
$.rails.href = function(element) {
return element.attr('href') || element.data('<%= SmartListing.config.data_attributes(:href) %>') || window.location.pathname;
}
Had to override again the $.rails.href
method to relay on the current path instead of using nothing to do the ajax call in the $.rails.handleRemote
method.
It worked fine at the time I tested it.
What you guys think, can you test it to see if the bug disappeared?
If everything's ok, let me know and I create a PR.
from smart_listing.
👍 💥
Can confirm this works ;)
from smart_listing.
I somehow messed up the first pull request. Is there still a demand of an example app that shows the problem?
from smart_listing.
Thanks!
from smart_listing.
Related Issues (20)
- Rails 5 Strong Parameters removes hash access for unpermitted params HOT 3
- Compatibility with rails 5.1 HOT 13
- be able to sort with an intance method of the class and not a column
- Prevent SQL Injection HOT 2
- Multiple params doesnt work after search HOT 1
- Update README regarding JS dependency HOT 1
- Pass locals params doesn't work HOT 1
- Rails 5.1 uses Webpack HOT 2
- Undefined local variable or method `smart_listing_resource' HOT 1
- Your site is down. HOT 1
- Elasticsearch with smart_listing
- Broken implicit sorting by join tables in v1.2.3 HOT 1
- Not all of the configured classes get applied?
- Replace kaminari with pagy
- The config editable class params should have side effect to broke gems
- Configured hidden class and popover_destroy command are not applied correctly
- needs to change pagination style
- "PG" Branch
- smart_listing.paginate broke with Ruby 3.1.1 HOT 3
- $(...).smart_listing is not a function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smart_listing.