Messager

Override defaults with $.messager.defaults.

Dependencies

Usage

  1. $.messager.alert('Warning','The warning message');  
  2. $.messager.confirm('Confirm','Are you sure you want to delete record?',function(r){  
  3.     if (r){  
  4.         alert('ok');  
  5.     }  
  6. });  

Properties

Name Type Description Default
ok string The Ok button text. Ok
cancel string The Cancel button text. Cancel

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.
msg: The message text to be showed.
title: The title text to be showed on header panel.
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.
$.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 window closed.
$.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.
$.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.
$.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');