Coder Social home page Coder Social logo

Comments (18)

ndelrossi avatar ndelrossi commented on August 14, 2024

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.

ljachymczyk avatar ljachymczyk commented on August 14, 2024

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.

ndelrossi avatar ndelrossi commented on August 14, 2024

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.

lacco avatar lacco commented on August 14, 2024

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.

ndelrossi avatar ndelrossi commented on August 14, 2024

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:

8519bd4

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.

lacco avatar lacco commented on August 14, 2024

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.

ljachymczyk avatar ljachymczyk commented on August 14, 2024

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

slbug avatar slbug commented on August 14, 2024

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.

shaneog avatar shaneog commented on August 14, 2024

Same problem for me. Testing in Safari on Mac, Chrome on Windows and Chrome on Mac.

from smart_listing.

shaneog avatar shaneog commented on August 14, 2024

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.

  1. Go to root
  2. Click link for /list1. Make some AJAX request (e.g. search, paging, etc). Smart Listing works
  3. Click link for list2. Make an AJAX request. Data from /list1 is retrieved via AJAX.

This should be enough to reproduce.

from smart_listing.

slbug avatar slbug commented on August 14, 2024

any news on it?

from smart_listing.

shaneog avatar shaneog commented on August 14, 2024

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.

ljachymczyk avatar ljachymczyk commented on August 14, 2024

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.

shaneog avatar shaneog commented on August 14, 2024

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.

estevaoam avatar estevaoam commented on August 14, 2024

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.

shaneog avatar shaneog commented on August 14, 2024

👍 💥

Can confirm this works ;)

from smart_listing.

wynksaiddestroy avatar wynksaiddestroy commented on August 14, 2024

I somehow messed up the first pull request. Is there still a demand of an example app that shows the problem?

from smart_listing.

ljachymczyk avatar ljachymczyk commented on August 14, 2024

Thanks!

from smart_listing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.