1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    153
    Vote Rating
    1
    JohnT is on a distinguished road

      0  

    Default 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:

    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);
    			}
    		
    		}
    	
    	};
    It's not coming in, however.

    and when I tried this:

    Code:
    fn: this.showResult(n),
    it's firing the function immediately.

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    2
    tryanDLS is on a distinguished road

      0  

    Default


    I would think you could use createDelegate like you would for an event handler.
    Code:
    fn: this.showResult.createDelegate(....)

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    225
    Vote Rating
    0
    seldon is on a distinguished road

      0  

    Default


    try:

    Code:
    fn: this.showResult.createDelegate(this, [n], true);

  4. #4
    Ext User
    Join Date
    Mar 2007
    Posts
    153
    Vote Rating
    1
    JohnT is on a distinguished road

      0  

    Default


    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);
    				}
    			
    		
    		}

  5. #5
    Ext User
    Join Date
    Mar 2007
    Posts
    153
    Vote Rating
    1
    JohnT is on a distinguished road

      0  

    Default


    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?

  6. #6
    Ext User
    Join Date
    Mar 2007
    Posts
    225
    Vote Rating
    0
    seldon is on a distinguished road

      0  

    Default


    Its probably the 3rd argument, instead of the 2nd

  7. #7
    Ext User
    Join Date
    Mar 2007
    Posts
    153
    Vote Rating
    1
    JohnT is on a distinguished road

      0  

    Default


    It is!

    showResult : function(btn,e, myNum)

    worked fine.

    What the heck is e???

  8. #8
    Ext User
    Join Date
    Mar 2007
    Posts
    31
    Vote Rating
    0
    Condor70 is on a distinguished road

      0  

    Default


    Quote Originally Posted by JohnT
    What the heck is e???
    It is the text entered in 'prompting' dialog boxes.

    (see http://yui-ext.com/playpen/yui-ext.0...g/msg-box.html)

  9. #9
    Sencha User
    Join Date
    Mar 2009
    Posts
    240
    Vote Rating
    0
    r_honey is on a distinguished road

      0  

    Default


    Hi, I am using the following:

    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])
                }; 
            }
    I get the following error:
    "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.

  10. #10
    Sencha User
    Join Date
    Mar 2009
    Posts
    240
    Vote Rating
    0
    r_honey is on a distinguished road

      0  

    Default


    Can anybody please help me???

Similar Threads

  1. How to pass value from json request to Ext.Field?
    By boydapa3 in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 21 Mar 2007, 7:22 AM
  2. Is it possible to pass a full Querystring into params?
    By deanotron in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 15 Mar 2007, 7:56 PM
  3. msgbox and onkeypress
    By alien3d in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 28 Feb 2007, 11:58 PM
  4. Pass Parameters to Handlers
    By Domitian in forum Ext 1.x: Help & Discussion
    Replies: 7
    Last Post: 2 Feb 2007, 3:58 PM
  5. how do you pass parameters?
    By Slapyo in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 30 Nov 2006, 2:15 PM

Thread Participants: 5

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar