Coder Social home page Coder Social logo

Comments (4)

chriszarate avatar chriszarate commented on June 10, 2024

Sorry for the brief response, I'm traveling.

Sheetrock is designed to have a 1:1 correspondence between DOM elements and queries. This aids with lazy-loading. So when you try to attach a different query, Sheetrock thinks it has already loaded the data.

However, it's relatively easy to "unload" or detach the previous query. You should be able to do something like this:

$('#playerdata').empty().data('sheetrockLoaded', false).sheetrock({...});

I can't test that at the moment, so apologies if the chaining isn't quite right.

In the future, perhaps I could test to see if the query has changed and do this automatically.

from sheetrock.

zachwhalen avatar zachwhalen commented on June 10, 2024

Hi Chris,

I've been traveling too, but I had time to try out the method you suggested and it worked. Thanks! I had tried empty(), but that didn't quite do it. I didn't think to chain that all together like your example.

And again, thanks for sheetrock. I'm finding it very useful.

Zach

from sheetrock.

chriszarate avatar chriszarate commented on June 10, 2024

FYI: I've addressed this in version 0.1.7 (just released). I've abandoned the previous 1:1 correspondence between DOM elements and queries, which wasn't really necessary and led to understandable confusion.

I also changed the way Sheetrock stores "flags" or "indicators"β€”for row offset, errors, and query completion. Previously it used jQuery.data which solidified the aforementioned 1:1 correspondence. Now it keeps track of them internally, indexed by unique query.

The fix we discussed above will continue to work, but the data(...) method is now unnecessary. With the latest version, you can simplify to:

$('#playerdata').empty().sheetrock({...});

Additionally, there's a new option (resetStatus) that allows you to reset the flags/indicators. This is useful if, for example, you'd like to load the exact same query again, reset the row offset, or try again after an error.

from sheetrock.

diogosouza avatar diogosouza commented on June 10, 2024

I had this problem too. Just for other people to know, now we have the option attribute "resetStatus": https://github.com/chriszarate/sheetrock#resetstatus.

I just set it to true and it worked. Thanks, great plugin.. Congrats! πŸ‘

from sheetrock.

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.