ExtJs快顯視窗

來源:互聯網
上載者:User

標籤:關閉   oca   mat   回呼函數   confirm   format   1.5   使用者   font   

1、Ext.Msg.alert(String title, String msg, [Function fn], [Object scope])

顯示一個標準的帶有一個“確定”按鈕的唯讀訊息框(類似於基本的JavaScript警告提示)。

參數:

  • title : 標題
  • msg : 提示訊息
  • fn : 訊息框關閉後調用的回呼函數
  • scope : 回呼函數被執行的範圍(this 引用,預設指向window)

eg:

1 Ext.Msg.alert("提示", "沒有可歸檔的檔案");2 Ext.Msg.alert("提示", "沒有可歸檔的檔案", function () {3     alert("提示框關閉");4 });

2、Ext.Msg.prompt( String title, String msg, [Function fn], [Object scope], [Boolean/Number multiline], [String value] )

顯示一個帶有“確定”和“取消”按鈕,提供使用者輸入一些文本的訊息框(類似於JavaScript的提示),可以是一個單行或者多行的文字框。

參數:

  • title : 標題
  • msg : 提示訊息
  • fn : 訊息框關閉後調用的回呼函數
  • scope : 回呼函數被執行的範圍(this 引用,預設指向window)
  • multiline : 為真時使用defaultTextHeight屬性建立一個多行文字框,或者以px為高度單位的文字框,預設為false
  • value : 文本輸入元素的預設值,預設為""

eg:

1 Ext.Msg.prompt(‘Name‘, ‘Please enter your name:‘, function (btn, text) {2     if (btn == ‘ok‘) {3         Ext.Msg.alert("Result", "button: " + btn + "<br> input: " + text);4     }5 }, this, 150, ‘wuln‘);

3、Ext.Msg.confirm( String title, String msg, [Function fn], [Object scope] )

顯示一個帶有“YES”和“NO”按鈕的確認訊息框(類似於JavaScript的確認)。

參數:

  • title : 標題
  • msg : 提示訊息
  • fn : 訊息框關閉後調用的回呼函數
  • scope : 回呼函數被執行的範圍(this 引用,預設指向window)

eg:

1 Ext.Msg.confirm("是否儲存", String.format(‘編輯檔案後選“是”則提交修改,選“否”則放棄修改<br/><br/>‘), function (e) {2     if (e == "yes") {3         Ext.Msg.alert("提示", "檔案儲存成功!");4     }5 }, this);

4、Ext.Msg.show( Object config )

顯示一個新的訊息框,或者基於配置項重新初始化一個已存在的訊息框。

常用配置項:

  • animEl: 動畫
  • buttons : 按鈕,取值如下

    Ext.Msg.OK

    Ext.Msg.YES

    Ext.Msg.NO

    Ext.Msg.CANCEL

  • title : 標題
  • msg : 提示訊息
  • fn : 訊息框關閉後調用的回呼函數
  • scope : 回呼函數被執行的範圍(this 引用,預設指向window)
  • width:訊息框的寬度,px為單位
  • multiline: 是否顯示多行文本
  • closable:是否顯示關閉按鈕
  • icon:表徵圖,取值如下

    Ext.MessageBox.INFO

    Ext.MessageBox.WARNING

    Ext.MessageBox.QUESTION

    Ext.MessageBox.ERROR

  • maxWidth : 最大寬度(px:預設600)
  • minWidth : 最小寬度(px:預設100)
  • modal : 是否模態顯示
  • progress : 是否顯示進度條
  • progressText : 進度為真時,顯示在進度條內部的文本

eg:

1 Ext.Msg.show({2     title: ‘Save Changes?‘,3     msg: ‘You are closing a tab that has unsaved changes. Would you like to save your changes?‘,4     buttons: Ext.Msg.YESNOCANCEL,5     icon: Ext.MessageBox.QUESTION6 });
 1 Ext.Msg.show({ 2     title: "提示", 3     msg: "請輸入:", 4     width: 400, 5     multiline: true, 6     closable: false, 7     buttons: Ext.MessageBox.OK, 8     icon: Ext.MessageBox.INFO, 9     fn: function (btn, text) {10         Ext.Msg.alert("Result", String.format("btn : OK<br> input: " + text));11     }12 });
 1 Ext.Msg.show({ 2     title: ‘請稍後‘, 3     msg: ‘正在匯出...‘, 4     progressText: ‘正在初始化...‘, 5     width: 400, 6     progress: true, 7     closable: false 8 }); 9 var progress = function (w) {10     return function () {11         if (w == 12) {12             Ext.Msg.hide();13             Ext.Msg.alert(‘完成‘, ‘匯出成功!‘);14         } else {15             var e = w / 11;16             Ext.Msg.updateProgress(e, Math.round(100 * e) + ‘%‘);17         }18     };19 };20 for (var i = 0; i < 13; i++) {21     setTimeout(progress(i), i * 500);22 }

 

ExtJs快顯視窗

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.