• EXTJS学习(二)Message


    上一节 EXTJS学习(一)
    上一节简单介绍了下EXTJS,接下来学习其中的消息类
    这里面有以下几个方法
    1.Alert
    alertString title, String msg, [Function fn], [Object scope] ) : 
    这里面后面两个参数是非必须的,以下是例子
     Ext.MessageBox.alert('Status', 'Changes saved successfully.', showResult);
     function showResult(btn){
            Ext.Msg('Button Click', btn);
        };
    2.confirm
    confirmString title, String msg, [Function fn], [Object scope] ) :
    这里的用法和alert相似
     Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', showResult);
     function showResult(btn){
            Ext.Msg('Button Click', btn);
        };
    3.Prompt
    promptString title, String msg, [Function fn], [Object scope], [Boolean/Number multiline] ) : Ext.MessageBox
    Ext.MessageBox.prompt('Name', 'Please enter your name:', showResultText);
    function showResultText(btn, text){
            Ext.Msg('Button Click', text);
        };
    其中第一个参数是按钮的参数,第二个参数是传递的值,也就是输入之后得到的值
    4.Multi-line Prompt
    Ext.MessageBox.show({
               title: 'Address',
               msg: 'Please enter your address:',
               300,
               buttons: Ext.MessageBox.OKCANCEL,
               multiline: true,
               fn: showResultText,
               animEl: 'mb3',
               icon: Ext.MessageBox.QUESTION
           });

    function showResultText(btn, text){
            Ext.Msg('Button Click', text);
        };
    其中title是显示的标题,msg是现实的提示消息,width是输入框的宽度,button这里是消息框中显示的按钮,multiline是否多行输入,fn处理函数,icon显示的图标
    5.Yes/No/Cancel
    Ext.MessageBox.show({
               title:'Save Changes?',
               msg: 'You are closing a tab that has unsaved changes. <br />Would you like to save your changes?',
               buttons: Ext.MessageBox.YESNOCANCEL,
               fn: showResult,
               animEl: 'mb4',
               icon: Ext.MessageBox.QUESTION
           });
    6.Progress Dialog

     Ext.MessageBox.show({
               title: 'Please wait',
               msg: 'Loading items...',
               progressText: 'Initializing...',
               300,
               progress:true,
               closable:false,
               animEl: 'mb6'
           });

           // this hideous block creates the bogus progress
           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);
           }
    下面的一部分是采用定时来刷新进度条,以及显示进度条
    7.Wait Dialog
    Ext.MessageBox.show({
               msg: 'Saving your data, please wait...',
               progressText: 'Saving...',
               300,
               wait:true,
               waitConfig: {interval:200},
               icon:'ext-mb-download', //custom class in msg-box.html
               animEl: 'mb7'
           });
            setTimeout(function(){
                //This simulates a long-running operation like a database save or XHR call.
                //In real code, this would be in a callback function.
                Ext.MessageBox.hide();
                Ext.example.msg('Done', 'Your fake data was saved!');
            }, 8000);
    警告里面大概就是这些了,更多的信息可以参考官方的文档

  • 相关阅读:
    js 获取浏览器版本号
    怎样写具体设计文档
    android PreferenceScreen使用笔记
    支持向量机通俗导论(理解SVM的三层境地)
    算法导论 第6章 堆排序(简单选择排序、堆排序)
    人脸识别算法初次了解
    循环队列
    ubuntu 下操作文件夹,出现Permission denied的解决的方法
    JFreeChart的使用
    隐藏Activity标题栏
  • 原文地址:https://www.cnblogs.com/dail/p/1128603.html
Copyright © 2020-2023  润新知