Fazil
Fazil

Reputation: 1390

On launch Alert

Here the code which i have used in sencha based application,In that i want to add a alert prompting enter your password! when the indexpnl launch.Here the code

var mainContainer = Ext.create('Ext.Panel', {
    id: 'mainContainer',
    layout: 'card',
    width: '100%',
    height: '100%',
    showAnimation: {
                    type: 'slideIn',
                    direction: 'right'
                   },
    items: [indexpnl,loginpnl,registerpnl,homepnl,viewitemspnl,forgpanel,myfriendpro,notifypanel,mapapnel,friendviewitemspnl]
    });
    Ext.Viewport.add({
        xtype: 'panel',
        items: [mainContainer]
    });

Alert

 function alertprompt()
 {
 var retVal = prompt("Enter your password? ", "Password");
 }

When application starts indexpnl shows first.I want to show the above alert with that.Where should i want to call the method alertprompt() to show on launch?PLease help to solve this problem

Upvotes: 0

Views: 77

Answers (3)

prakash
prakash

Reputation: 83

If you are using launch function to add xtype into your Viewport. You can use "Ext.Msg.prompt(...)" there. After password get's successful you can add pannel into the viewport. Note : I am assuming that your going to display your main container after password validation. Eg :`

    launch:function(){
     Ext.Msg.prompt('Authentication Process!','Please enter your password:', function(button,text){
       if(button=='ok'){
         //Do your password validation here. Then add your panel into the Viewport
       }
       else
       {
         Ext.Msg.alert('Reload the application and give your password');
       }
     });
   },

`

Upvotes: 0

Surya Prakash Tumma
Surya Prakash Tumma

Reputation: 2203

Hi you can use this listener just add the below code

listeners:{

         afterrender:function(t,eOpts){

            alert("Enter your password");

        }

      }

Upvotes: 0

Aashray
Aashray

Reputation: 2763

I'm assuming you are calling Ext.onReady(); to invoke your function which shows indexpnl.

Lets assume this function is start().

function start() {
    //do your panel rendering to where ever
    alertprompt();
}

Upvotes: 1

Related Questions