Jump to content

ips.ui.alert

Description

The alert widget is designed to replace the built-in javascript alert, providing a more pleasant user experience as well as more flexible options and built in callbacks. Several other types of alert dialogs are supported too.

Usage

Unlike most UI widgets, the alert widget is instantiated programatically, rather than using the data API - typically as a response to a user action in a controller, for example.

An alert is created as follows:

ips.ui.alert.show( {
	type: 'alert',
	icon: 'warning',
	message: 'Alert message',
	subText: 'Message subtext',
	callbacks: {
		ok: function () {
			// Do something
		}
	}
});

Each type of alert shows different buttons depending on the use; a callback can be assigned to each button shown for that type.

Alert types

Alert

Shows a message, with a single button to dismiss the alert.

  • Type: alert
  • Available button callbacks: ok

 

Confirm

Confirm shows a message with OK and Cancel buttons.

  • Type: confirm
  • Available button callbacks: ok, cancel

 

Prompt

Shows a message with OK and Cancel buttons, and prompts the user to input a value. Both callbacks receive the entered value as the first parameter.

  • Type: prompt
  • Available button callbacks: ok, cancel

 

Verify

Verify shows a message with Yes and No buttons.

  • Type: verify
  • Available button callbacks: yes, no

 

Events

No events are emitted by the alert widget; since callbacks are supported, custom events can be triggered inside them to achieve desired functionality.


  Report Guide


×
×
  • Create New...