-
19 Feb 2009 3:54 AM #1
My window just keep loading, loading, loading
My window just keep loading, loading, loading
Need some help from you guys out there.
I've made a nice event calendar (thanks cmendez21
) and decided to let the window perform a autoRefresh for every x sec.
However, when my window starts to refresh on its own, it seems to run into a while loop and keep loading, loading, loading... Like this:

(it is still loading while I am typing this thread)
I really have no idea what's wrong
Here's my code:
Hope that someone can point out my mistakes. ThanksPHP Code:var eventCalendarReader = new Ext.data.JsonReader(
{
root: 'eventCalendars.data',
id: 'id',
successProperty: 'eventCalendars.success',
totalProperty: 'eventCalendars.totalRows'
},
[
{name:'recid', mapping:'id', type: 'string'},
{name:'subject', mapping:'subject', type: 'string'},
{name:'description', mapping:'eventDescription', type: 'string'},
{name:'startdate', mapping:'eventStartDate', type: 'string'},
{name:'enddate', mapping:'eventEndDate', type: 'string'},
{name:'color', mapping:'color', type: 'string'},
{name:'parent', mapping:'parent', type: 'int'},
{name:'priority', mapping:'priority', type: 'int'}
]
);
// Create an http proxy
var httpProxy = new Ext.data.HttpProxy({url: 'listAllEventCalendar.action'});
// Datastore for event calendar
var eventCalendarDataStore = new Ext.data.Store({
proxy: httpProxy,
reader: eventCalendarReader
});
function loadAndShowEventCalendar(recordArray, options, success) {
prueba = new Ext.ECalendar({
// codes to create my calendar
});
win = new Ext.Window({
// codes to add my calendar into a window
});
win.on('render',function(){
win.getUpdater().startAutoRefresh(15, function(){
eventCalendarDataStore.reload();
});
prueba.refreshCalendarView();
});
win.show();
// trigger the data store load
eventCalendarDataStore.load({params:{start:0, limit:10}});
}

-
19 Feb 2009 5:53 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 29
I'm very confused as to what you're trying to do. The updater will fetch HTML from some remote location and display it in the container's body.
That said, you'r eusing a datastore. is Ext.ECalendar a descendant of Ext.DataView?
This is really strange.
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
19 Feb 2009 6:15 PM #3
-
19 Feb 2009 8:13 PM #4
jeez what you're trying to do

The calendar does extends the panel but not the dataview (the calendar code controls all the rendering for each view) now one of the things its:
1.- Why you need to refresh every X seconds , let the user refreshes the calendar by the (Gear) toolbar.
2.- The calendar delays a while while rendering all the view plus the events in some cases its kinda slow and for some users its fast, and also not so fast to refresh every x seconds while you are refreshing the calendar doesn't even finish the first render so you may enter in a big loop
Maybe you could refresh every N Minutes instead but the memory its going to increase huge (in firefox and chrome are the faster to render the calendar) even you have to calculate the time aprox from the speed of the proxy you are requesting
Instead better set a timer to N minutes to reload the store you don't need to refresh the window I don't think the events are created every n second or do they
?
I dont see a good reason to refresh every n second..!
If it was a chat i grant it but need more explanation of what you're trying to do so i could give you perhaps an alternative
-
20 Feb 2009 12:37 AM #5

Oh well, it's a request from my client.. What they hope to see is that when a user is updating the calendar the other user who is viewing the same calendar gets to see the new event automically (without refreshing the calendar)
Anyway, it is just a try-out and if it is not possible, I'll get back to my client.
btw, I don't intend to refresh it @ 5sec... What I want is to refresh it like every 5min. (The 5sec is for me to test if the updater is working with the function)
I'll set the refresh rate to 5min then
-
20 Feb 2009 10:45 AM #6
Its possible to achieve this as you told , but if youre gonna test it on seconds to see if works include some "console" logs instead of the calendar and for the every 5 minutes include the calendar and test every 5 minutes , i know it could be kind boring to be waiting every 5 minutes but its worth it
for my developments i first test as separate parts and then when i see every part works fine i put it all together and test


Reply With Quote
