-
7 Sep 2010 1:16 AM #1
Schedule method call with setTimeout
Schedule method call with setTimeout
Hi,
I want to simulate setTimeout() function. it receives global function name. I must pass to setTimeout my method name of Ext object...
Example:
setTimeout("this.autoRefresh()", 3000); run first time but then it generate error...Code:RefreshLayersComponent = Ext.extend(Ext.FormPanel, { id: 'RefreshLayersComponent', constructor: function(config) { ... ... }, afterRender: function() { RefreshLayersComponent.superclass.afterRender.apply(this, arguments); this.autoRefresh(); }, refresh: function() { ... ... }, autoRefresh: function() { this.refresh(); setTimeout("this.autoRefresh()", 3000); } });
Error is: this.autoRefresh is not a function
Can you help me please?
Thanks in advance
Luca
-
7 Sep 2010 1:19 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
That is because setTimeout executes in the 'window' scope.
You want:
Code:Ext.TaskMgr.start({ run: this.refresh, scope: this, interval: 3000 });
-
23 Sep 2012 10:45 PM #3
Hi,
I tried to catch the onclose event of popup by Ext.TaskManager but i doesnt run. Could you tell me what is the problem in my code?
Thank you
Code:createEditor: function(){ this.editor = Ext.create('widget.texteditor',{ height: 200 }); var toolbar = this.editor.getToolbar(); toolbar.add({ iconCls: 'icon-attachment', scope: this, handler: function() { var myWindow = window.open('<%=PopupUrl(.....................'); this.pollForWindowClosure(myWindow); } }); return this.editor; }, pollForWindowClosure: function(myWindow){ if (myWindow.closed){ this.myFunc(); return; } //setTimeout(function(){this.pollForWindowClosure(myWindow)}, 10); Ext.TaskManager.start({ //run: this.refresh, run: function(){this.pollForWindowClosure(myWindow)}, scope: this, interval: 10 }); }, myFunc: function(){ alert('789'); },
Similar Threads
-
Help me call a method please.
By Elijah in forum Ext 3.x: Help & DiscussionReplies: 2Last Post: 14 Dec 2009, 6:58 AM -
call java method from XTemplate
By friedc in forum Ext GWT: Help & Discussion (1.x)Replies: 0Last Post: 21 Apr 2009, 7:21 AM -
Call a method within a method
By Padster in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 20 Aug 2008, 8:24 AM -
How to call Java method using EXTJS
By naveen namburi in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 31 Mar 2008, 10:23 PM



Reply With Quote