Results 1 to 3 of 3

Thread: Ext.Msg.confirm() is not working on tap of the image

  1. #1
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
      0  

    Default Ext.Msg.confirm() is not working on tap of the image

    Here is Mycode:
    Code:
    {
    xtype: 'image',
    src: 'Imagepath',
    listeners: {
    tap: function () {
    
    
    //Confirmation message
    Ext.Msg.confirm(
    "Confirmation",
    "Are you sure you want to proceed?",
    function (btn) {
    if (btn === 'yes') {
    Ext.Msg.alert("You have selected Yes", "");
    }
    else {
     Ext.Msg.alert("You have selected NO", "");
    }
    },
    this
    );
    
    
    //Normal alert message
    alert("HI");
    
    
    }
    }
    I want to show confirmation alert message to user on tap of the image. in the listeners i have defined tap function, within that defined Ext.Msg.confirm(""). when i tap the image i am not getting confirmation message. so below of this one i have defined normal alert message "Hi". after this one i am able to see only normal alert message "HI". not getting confirmation message. on image tap i need to display confirmation message to user to confirm Yes/No. same code i have used for button handler function. Ext.Msg.confirm(""). message working fine. is image tap support Ext.Msg.confirm("") or not? if possible then how to achieve this one. any one tell me how to do.

  2. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Vote Rating
    100
      1  

    Default

    That is wierd.. I went to Ext.Img to try their demo and inserted your code (formatted to fit their demo) and it worked fine.
    Code:
    var img = Ext.create('Ext.Img', {
        src: 'http://www.sencha.com/assets/images/sencha-avatar-64x64.png',
        height: 64,
        width: 64,
        listeners: {
            tap: function(me){
                Ext.Msg.confirm('confirm', 'yes or no?', function(btn){
                    if(btn === 'yes'){
                        Ext.Msg.alert("You have selected Yes", "");
                    }
                    else {
                        Ext.Msg.alert("You have selected NO", "");
                    }
                });
            }
        }
    });
    Ext.Viewport.add(img);
    Edit: When you have that extra alert('HI') in your previous code, that is done first before the Ext.Msg can be painted on the screen.

  3. #3
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
      0  

    Default

    Thanks a lot...it is working fine.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •