$.messager.progress ajax,messager - Documentation - jQuery EasyUI

Messager

Override defaults with $.messager.defaults.

the messager provide different styles of message boxes, including alert, confirm, prompt, progress, etc.

All the messager boxes are asynchronous.

Users can use the callback function to do something after interacting with messager.

a2b1efc5a758be78a0bf0ca23d4077fb.png

Dependencies

dialog

linkbutton

progressbar

Usage

$.messager.alert('Warning','The warning message');

$.messager.confirm('Confirm','Are you sure you want to delete record?',function(r){

if (r){

alert('ok');

}

});

Properties

The properties extend from dialog, below is the added properties for messager.

Name

Type

Description

Default

ok

string

The Ok button text.

Ok

cancel

string

The Cancel button text.

Cancel

msg

string

The message to display on the dialog.

fn

function

The callback function when clicking on the OK or CANCEL buttons.

Methods

Name

Parameters

Description

$.messager.show

options

Show a message window on right bottom of screen. The options parameter is a configuration object:

showType: Defines how the message window to be showed. Available values are: null,slide,fade,show. Defaults to slide.

showSpeed: Defines the time in milliseconds message window finishs show. Defaults to 600.

width: Defines the width of message window. Defaults to 250.

height: Defines the height of message window. Defaults to 100.

title: The title text to be showed on header panel.

msg: The message text to be showed.

style: Defines the custom style for message window.

timeout: If defines to 0, the message window will not close unless user close it. Defines to unzero, the message window will be auto closed when timeout. Defaults to 4 seconds.

Code example:

$.messager.show({

title:'My Title',

msg:'Message will be closed after 5 seconds.',

timeout:5000,

showType:'slide'

});

// show message window on top center

$.messager.show({

title:'My Title',

msg:'Message will be closed after 4 seconds.',

showType:'show',

style:{

right:'',

top:document.body.scrollTop+document.documentElement.scrollTop,

bottom:''

}

});

$.messager.alert

title, msg, icon, fn

Show an alert window. Parameters:

title: The title text to be showed on header panel.

msg: The message text to be showed.

icon: The icon image to be showed. Available value are: error,question,info,warning.

fn: The callback function triggered when clicking on the OK button.

The configuration object can be passed to the function argument.

Code example:

$.messager.alert('My Title','Here is a info message!','info');

$.messager.alert({

title: 'My Title',

msg: 'Here is a message!',

fn: function(){

//...

}

});

$.messager.confirm

title, msg, fn

Show a confirmation message window with Ok and Cancel buttons. Parameters:

title: The title text to be showed on header panel.

msg: The message text to be showed.

fn(b): The callback function, when user click Ok button, pass a true value to function, otherwise pass a false to it.

The configuration object can be passed to the function argument.

Code example:

$.messager.confirm('Confirm', 'Are you sure to exit this system?', function(r){

if (r){

// exit action;

}

});

$.messager.confirm({

title: 'My Title',

msg: 'Are you confirm this?',

fn: function(r){

if (r){

alert('confirmed: '+r);

}

}

});

$.messager.prompt

title, msg, fn

Show a message window with Ok and Cancel buttons prompting user to enter some text. Parameters:

title: The title text to be showed on header panel.

msg: The message text to be showed.

fn(val): The callback function with a value parameter user entered.

The configuration object can be passed to the function argument.

Code example:

$.messager.prompt('Prompt', 'Please enter your name:', function(r){

if (r){

alert('Your name is:' + r);

}

});

$.messager.prompt({

title: 'Prompt',

msg: 'Please enter your name:',

fn: function(r){

if (r){

alert('Your name is:' + r);

}

}

});

$.messager.progress

options or method

Show a progress message window.

The options is defined as:

title: The title text to be showed on header panel, default ''.

msg: The message box body text, default ''.

text: The text to display in the progress bar, default undefined.

interval: The length of time in milliseconds between each progress update, default 300.

The method is defined as:

bar: Get the progressbar object.

close: Close the progress window.

Code example:

Show progress message window.

$.messager.progress();

Now close the message window.

$.messager.progress('close');

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值