Ext js 消息框组件

1.基本弹出框

 Ext.Msg.alert('Title', 'Basic message box in ExtJS');
{
   xtype: 'button',
   text: 'Button',
   listeners: {
      click: function () {
          Ext.Msg.alert('确定', '弹出框显示');
               }
         }
}

2.确认弹出框

 Ext.MessageBox.confirm('Confirm', Msg, optional callbackFunction());
{
   xtype: 'button',
   text: 'confirm',
   listeners: {
       click: function () {
       Ext.MessageBox.confirm('确认么', 'Are you sure you want to do this ?', callbackFunction);
​
       function callbackFunction(btn) {
            if (btn == 'yes') {
                   Ext.Msg.alert('Click', 'You clicked the Yes button');
             } else {
                   Ext.Msg.alert('Click', 'You clicked the No button');
                    }
            };
      }
 }
}

3.提示弹出框

 Ext.Msg.prompt('Name', 'Please enter your name:', function(){});
{
   xtype: 'button',
   text: 'Click Me',
   listeners: {
      click: function () {
      Ext.Msg.prompt('Name', 'Please enter your name:', function (btn, text) {
          if (btn == 'ok') {
              Ext.Msg.alert('Hello', 'Hello ' + text);
            }
      });
    }
  }
}

4.多行用户输入框

Ext.MessageBox.show({
   title: 'Details',
   msg: 'Please enter your details:',
   width:300,
   buttons: Ext.MessageBox.OKCANCEL,
   multiline: true,  // this property is for multiline user input.
   fn: callbackFunction
});
{
    xtype: 'button',
    text: 'Click Me',
    listeners: {
        click: function() {
            Ext.MessageBox.show({
            title: 'Details',
            msg: 'Please enter your details:',
            width:300,
            buttons: Ext.MessageBox.OKCANCEL,
            multiline: true,
            fn: callbackFunction
        });
​
    function callbackFunction (){
        Ext.Msg.alert('status', 'Details entered succesfully');
            }
        }
    }
}

5.是否取消框

Ext.MessageBox.show({
   title: 'Details',
   msg: 'Please enter your details:',
   width:300,
   buttons: Ext.MessageBox.YESNOCANCEL // this button property for all three options YES, NO, Cancel.
});
{
    xtype: 'button',
    text: 'Click Me',
    listeners: {
        click: function() {
            Ext.MessageBox.show({
            title: 'Details',
            msg: 'Please enter your details:',
            width:300,
            buttons: Ext.MessageBox.YESNOCANCEL,
            multiline: true,
            fn: callbackFunction
        });
​
        function callbackFunction (){
            Ext.Msg.alert('status', 'Details entered succesfully');
            }
        }
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值