-
20 Nov 2009 6:09 AM #1
[solved] Delay starting PollingProvider
[solved] Delay starting PollingProvider
I am using a polling provider with an interval of 300 seconds.
Now, I would like to have the first poll request 300 seconds after page loading instead of directly after loading. My workaround isCode:Ext.Direct.addProvider({ id: 'poll', type: 'polling', url: 'poll.php', interval: 300000 });
but I am wondering if there is a cleaner/better way to do this?Code:Ext.Direct.getProvider('poll').disconnect(); setTimeout("Ext.Direct.getProvider('poll').connect()", 300000);
-
23 Nov 2009 9:38 AM #2
Ext adds on a couple of convenience methods to all functions within JavaScript one of them is defer.
Defer allows you to defer/delay a functions execution and further specify what scope it will run in (the context of this) and any additional arguments you'd like to pass to it.
Try this:
Code:var dp = Ext.Direct.getProvider('poll'); dp.disconnect(); dp.connect.defer(30000, dp);Aaron Conran
@aconran
Sencha Architect Development Team
-
23 Nov 2009 12:42 PM #3
thx, defer seems a useful extjs function I wasn't aware of


Reply With Quote