-
8 Feb 2007 8:04 AM #1
Can I pass parameters to MsgBox Callback?
Can I pass parameters to MsgBox Callback?
I am trying to pass an the variable n to my callback function:
It's not coming in, however.Code:confirmDelete : function(el, n, sName){ Ext.MessageBox.show({ title:'Delete Your Song?', msg: 'You are about to delete your song. This is permanent. Are you sure?', buttons: Ext.MessageBox.YESNO, fn: this.showResult, animEl: 'mylogo' }); }, showResult : function(btn,n){ // if(btn==true){ alert("Deleting Song Number: " + n); } } };
and when I tried this:
it's firing the function immediately.Code:fn: this.showResult(n),
-
8 Feb 2007 8:06 AM #2
I would think you could use createDelegate like you would for an event handler.
Code:fn: this.showResult.createDelegate(....)
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
8 Feb 2007 8:07 AM #3
try:
Code:fn: this.showResult.createDelegate(this, [n], true);
-
8 Feb 2007 8:26 AM #4
hmmm.. no luck.
Apparently, only the resulting button information is being passed. N is not making the trip.
Code:confirmDelete : function(el, n, sName){ Ext.MessageBox.show({ title:'Delete Your Song?', msg: 'You are about to delete your song. This is permanent. Are you sure?', buttons: Ext.MessageBox.YESNO, fn: this.showResult.createDelegate(this, [ n], true), animEl: 'mylogo' }); }, showResult : function(btn, n){ if(!n){ console.log("Where is the heck is n?"); } // Do nothing. if(btn=="yes"){ alert("Song Number: " + n); } }
-
8 Feb 2007 8:44 AM #5
When I put this in:
Code:if(!n){ for(var i=0; i<arguments.length; i++){ console.log(arguments[i]); } } // Do nothing. if(btn=="yes"){ alert(n); }
I am seeing the correct info in the console?!?!?
yes <----- the button I pressed
18 <----- the song number
but it's not alerting. How weird is that?
-
8 Feb 2007 8:55 AM #6
Its probably the 3rd argument, instead of the 2nd
-
8 Feb 2007 9:11 AM #7
It is!
showResult : function(btn,e, myNum)
worked fine.
What the heck is e???
-
8 Feb 2007 10:35 AM #8
It is the text entered in 'prompting' dialog boxes.
Originally Posted by JohnT
(see http://yui-ext.com/playpen/yui-ext.0...g/msg-box.html)
-
17 Apr 2009 2:26 AM #9
Hi, I am using the following:
I get the following error:Code:function ratingChanged(behId, pageId) { var myBehavior = $find(behId); Ext.Msg.show({ title: 'Update Rating', msg: 'Update this Rating to the server ?', buttons: Ext.Msg.YESNO, closable: false, fn: updateRating.createDelegate(behId, pageId), opt: pageId, icon: Ext.MessageBox.QUESTION }); } function updateRating(btn, b, c, d, e, f, g, h) { for (var i = 0; i < arguments.length; i++) { alert(arguments[i]) }; }
"Array or arguments object expected"
after I click any button on the message box. I need both the button clicked, as well as my (multiple) arguements in the callback.
-
23 Apr 2009 12:03 AM #10
Similar Threads
-
How to pass value from json request to Ext.Field?
By boydapa3 in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 21 Mar 2007, 7:22 AM -
Is it possible to pass a full Querystring into params?
By deanotron in forum Ext 1.x: Help & DiscussionReplies: 3Last Post: 15 Mar 2007, 7:56 PM -
msgbox and onkeypress
By alien3d in forum Ext 1.x: Help & DiscussionReplies: 0Last Post: 28 Feb 2007, 11:58 PM -
Pass Parameters to Handlers
By Domitian in forum Ext 1.x: Help & DiscussionReplies: 7Last Post: 2 Feb 2007, 3:58 PM -
how do you pass parameters?
By Slapyo in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 30 Nov 2006, 2:15 PM


Reply With Quote