Ext初级学习-Windows

来源:互联网 发布:盟军敢死队2 for mac 编辑:程序博客网 时间:2024/06/06 17:38

//Ext创建Windows弹出面板,以及Ext.MessageBox一些弹出窗口的简单样例语句

Ext.onReady(function(){

  var win,

      button=Ext.get("but_id"); //获取页面ID

      button.on('click',function(){

               if(!win){

                  win = Ext.create('widget.window',{

                       title:'Layout Window',

                       closable:true,

                       closeAction:'hide',

                        width:600,

                         minWidth:350,

                         height:350,

                         layout:'border',

                         bodyStyle:'padding:5px;',

                          items:[

                              {

                                     region:'west',

                                     title:'navigation',

                                      width:200,

                                      split :true,

                                       collapsible:true,

                                        floatable:false

                                },{

                                        region:'center',

                                         xtype:'tabpanel',

                                         items: [{

                                                    title:'Bogus Tab',

                                                    html:'Hello World 1'

                                            },{

                                                    title:'Another Tab',

                                                     html:'Hello World 2'

                                                  },{

                                                    title:'Closable Tab',

                                                    html:'Hello Word 3',
                                                     closable:true

                                             }]

                                  }]

                });

            }

    });

});

 

Ext.onReady(function(){

    //confirm

     Ext.get('mb1').on('click',function(e){

          Ext.MessageBox.confirm('Confirm','Are you sure to do that?',showResult);              

    });
    //prompt

    Ext.get('mb1').on('click',function(e){

         Ext.MessageBox.prompt('Name','Please enter you name:',showResultText);
    });

    //Multi-line Prompt   

      Ext.get('mb1').on('click'.function(e){

         Ext.MessageBox.show({

                   title:'Address',

                   msg:'Please enter you address:',

                   width:300,

                   buttons:Ext.MessageBox.OKCANCEL,

                   multiline:true,

                    fn:showResultText,

                   animateTarget: 'mb3'

           });

     });

      //yes/no/cancel

          Ext.get('but1').on('click',function(e){

             Ext.MessageBox.show({

                    title:'Save Changes?',

                    msg:'You are closing a tab that has unsaved changes.  </br>  Would you like to save you changes?',

                    fn: showResultText,

                    animateTarget:'mb4',

                     icon:Ext.MessageBox.QUESTION

         });

     });

        //progress Dialog
            Ext.get('but1').on('click',function(e){

                 Ext.MessageBox.show({

                             title:'Please Wait',

                             msg:'Loading times......',

                              progressText:'Initializing...',

                              width:300,

                              progress:true,

                              closable:true,

                              animateTarget:'mb6'

               });

               var f=function(v){

                       return function(){

                           if(v==12){

                                              Ext.MessageBox.hide();

                                              Ext.example.msg('Done','Your fake items  were loaded!');            

                                 }else{

                                          var i=v/11;

                                            Ext.MessageBox.updateProgress(i,Math.round(100*i)+'% completed');

                              }

                         };

                  };

                     for (var i=1,i<13;i++){

                         setTimeout(f(i),i*500);  

                   }

      });

         //wait

             Ext.get('but1').on('click',function(){

                 Ext.MessageBox.show({

                             msg:'Saving you data,please wait...',

                              progressText:'Saving...',

                              width:300,

                               wait:true,

                               waitConfig: {interval:200},

                                icon:'ext-mb-download',

                                 animateTarget:'but1',                               

                 });

                   setTimeout(function(){

                           Ext.MessageBox.hide();

                           Ext.example.msg('Done','Your fake data was saved'),  

                     },8000);

           });

             Ext.get('but1').on('click',function(){

                    Ext.MessageBox.alert('Status','Changes saved success',showResult);

         });

            function showResult(btn){

                     Ext.example.msg('Click Button','You clicked the {0} button',btn);

               }

           function showResult(btn,text){

                     Ext.example.msg('Click Button','You clicked the {0} button and entered the text  "{1} " ',btn,text);

             }

  });

原创粉丝点击