GithubHelp home page GithubHelp logo

Comments (4)

cjolif avatar cjolif commented on June 9, 2024

Can you provide a sample example that does reproduce your issue? Or at least a code excerpt that shows how you do your polling / refresh?
Thanks.

from dojo-calendar.

httpete avatar httpete commented on June 9, 2024

Christophe,

Thank you for helping us. We are very excited about this new control you have built.

In my startup() I do: (

var o = {
start: stamp.toISOString(interval[0], opts),
end: stamp.toISOString(interval[1], opts)
};
this.query = o;
calendar.set("store", new Observable(new JsonRestStore({target: "appointments/"})));

and then, whenever the interval changes,

var o = {
start: stamp.toISOString(interval[0], opts),
end: stamp.toISOString(interval[1], opts)
};
var results = this.store.query(o, { overwrite: true });
results = results.map(lang.hitch(this, function(item){
return this.itemToRenderItem(item, this.store);
}));
when(results, lang.hitch(this, "_initItems"));

and I poll that (refresh that call ) every 30 seconds. At first I thought all was well, and then I noticed my Firebug HTML inspector scrollbar grow and grow every 30 seconds. It is overlaying the events, instead of refreshing them.

We can do a teamviewer if this would help you. Let me know. We can also support this project financially.

Pete

from dojo-calendar.

cjolif avatar cjolif commented on June 9, 2024

Thanks for your kind words. So you are re-executing that piece of code:

var results = this.store.query(o, { overwrite: true }); 
results = results.map(lang.hitch(this, function(item){ return this.itemToRenderItem(item, this.store); })); when(results, lang.hitch(this, "_initItems"));

on each poll request?

If yes then I understand why you get that behavior. For the items to be correctly updated automatically and not re-created you need to rely on the store observation mechanism. And that's not what you are apparently doing. I guess because JsonRest does not provide a polling mechanism so you implemented it yourself.

So you either needs to wrap JsonRest and implement a polling mechanism to correctly notify Observable of data changes or if you still want to manage that in your code you are probably better of calling _updateItems than _initItems as you do now. Indeed _updateItems will make sure to not create items but just updates them.

from dojo-calendar.

damiengarbarino avatar damiengarbarino commented on June 9, 2024

I'm closing this issue as Christophe seems to have answered correctly. If something is still unclear, we can reopen it.

from dojo-calendar.

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.