Ext.MessageBox 大集合 不同的dialog图解加写法 出自example

我们知道在Ext中有很多漂亮的dialog,如何做出来在Ext中原带的example中有写。但是为了以后方便用,特写这样一篇博文 以下是效果图和代码还有部分注释, 大家根据自己需要略加修改就好:

1、alert对话框 效果图:

代码:

function a1(){ //alert案例 Ext.MessageBox.alert('title','text'); }

2、confirm案例,确定不确定2个按钮对话框

效果图:


代码:

Ext.MessageBox.confirm('title','warn test',showres); function showres(btn){ //传入btn alert(btn); }

3、prompt案例,带有输入框的对话框

效果图:

代码:

function p1(){ Ext.MessageBox.prompt('title','请输入一些文档',showrestxt); } function showrestxt(btn,text){ alert(btn); alert(text); }

4、带有输入框的对象框show

效果图:

代码:

function s1(){ //可以写带有图片的确认框,自定义确认框 Ext.MessageBox.show({ title: 'Address', msg: 'Please enter your address:', width:300, buttons: Ext.MessageBox.OKCANCEL, //or Ext.MessageBox.OKNOCANCEL, multiline: true, fn: showrestxt }); }

5、progress进度条的show对话框

效果图:


代码:

//进度条对话框 function s2(){ Ext.MessageBox.show({ title: 'Please wait', msg: 'Loading items...', progressText: 'Initializing...', width:300, progress:true, closable:false }); // 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); } }

6、保存对话框带进度对话框(图片文件未加入)

效果图:



代码:

/下载时候图像的对话框 function downl(){ Ext.MessageBox.show({ msg: 'Saving your data, please wait...', progressText: 'Saving...', width: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); }

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值