zoukankan      html  css  js  c++  java
  • ExtJS4 Dialog

    一个简单的Dialog

    <script type="text/javascript">
            Ext.onReady(function () {
                Ext.widget('button', {
                    text: 'Click Me',
                    renderTo: document.body,
                    handler: function () {
                        Ext.Msg.alert('This is title', 'This is content!');
                    }
                });
            });
        </script>

    带回调函数的

     ---》

     Ext.onReady(function () {
                Ext.widget('button', {
                    text: 'Click Me',
                    renderTo: document.body,
                    handler: function () {
                        var button = this;
                        Ext.Msg.alert('This is title', 'This is content!', function () {
                            button.setText("谢谢!");
                        });
                    }
                });
            });

     confirm窗体

    Ext.onReady(function () {
                Ext.widget('button', {
                    text: 'Click Me',
                    renderTo: document.body,
                    handler: function () {
                        Ext.Msg.confirm('I have a question', 'Do you like WangJunwei blog?', function (button) {
                            if (button == 'yes') {
                                Ext.Msg.alert('谢谢', '你点击了Yes');
                            }
                            else {
                                Ext.Msg.alert('No', '你点击了NO!');
                            }
                        });
                    }
                });
    });

    按钮的作用域

    Ext.onReady(function () {
                Ext.widget('button', {
                    text: 'Click Me',
                    renderTo: document.body,
                    handler: function () {
                        Ext.Msg.alert('标题', '内容', function () {
                            this.setText("谢谢!");
                        },this);
                    }
                });
            });

    Prompt alert

    Ext.onReady(function () {
                Ext.widget('button', {
                    text: 'Click Me',
                    renderTo: document.body,
                    handler: function () {
                        Ext.Msg.prompt('Hello', 'Enter you name', function (button, value) {
                            value = value || 'empty string';
                            Ext.getCmp('console').update(
                                 Ext.String.format('<pre>Button:{0}<br>Value:{1}</pre>', button, value);
                            );
                        });
                    }
                });
                Ext.widget('panel',{
                    id:'console',
                    400,
                    margin:'5 0 0 0',
                    html:'&nbsp;',
                    bodyPadding:0,
                    renderTo:document.body
                });
            });

    Progress Dialog

     Ext.onReady(function () {
                Ext.widget('button', {
                    text: 'Click Me',
                    renderTo: document.body,
                    handler: function (button) {
                        button.disable(); //禁用按钮
                        var progress = Ext.Msg.progress('please wait', 'Progress...');
                        var value = 0.0;
                        var interval = setInterval(function () {
                            value += 0.1;
                            progress.updateProgress(Math.min(value, 1));//更新进度
                            if (value >= 1.0) {
                                clearInterval(interval);
                                progress.close();//关闭进度提示
                                button.enable();//按钮可用
                            }
                        }, 500);
                    }
                });
    
    });

    Wait Dialog

    Ext.onReady(function () {
                Ext.widget('button', {
                    text: 'Click Me',
                    renderTo: document.body,
                    handler: function (button) {
                        var progress = Ext.Msg.wait('Please wait 5秒后关闭', 'Progress...');
                        setTimeout(function () {
                            progress.close();
                        },5000);
                    }
                });
    });

    Window With Info Icon

    buttons和icon的参数,可以查看API中有多个选项

    buttons: Ext.Msg.YESNO, 属性返回类型为number

    icon: Ext.Msg.INFO, 属性返回为 string的

    例如修改:

    buttons: Ext.Msg.YESNO,
    icon: Ext.Msg.ERROR,

    Ext.onReady(function () {
                Ext.widget('button', {
                    text: 'Click Me',
                    renderTo: Ext.getBody(),
                    handler: function () {
                        Ext.Msg.show({
                            title: 'Infomation',
                            msg: 'Some info message here!',
                            buttons: Ext.Msg.OK,
                            icon: Ext.Msg.INFO,
                            fn: function () {
                                Ext.Msg.alert('Callback', '回调函数');
                            }
                        });
                    }
                });
            });
  • 相关阅读:
    BZOJ.2916.[POI1997]Monochromatic Triangles(三元环)
    Codeforces.724G.Xor-matic Number of the Graph(线性基)
    BZOJ.3498.[PA2009]Cakes(三元环 枚举)
    BZOJ.3545.[ONTAK2010]Peaks(线段树合并)
    BZOJ.4919.[Lydsy1706月赛]大根堆(线段树合并/启发式合并)
    BZOJ.2212.[POI2011]Tree Rotations(线段树合并)
    BZOJ.4552.[HEOI2016/TJOI2016]排序(线段树合并/二分 线段树)
    Codeforces.547C.Mike and Foam(容斥/莫比乌斯反演)
    BZOJ.4516.[SCOI2016]幸运数字(线性基 点分治)
    页面置换算法
  • 原文地址:https://www.cnblogs.com/wangjunwei/p/2910272.html
Copyright © 2011-2022 走看看