new Alert(options)
Display a message.
Display one message on a page. Several instances can be used per page, which results in messages being stacked, with the latest message being at the bottom.
The first instance displaying a message will append an alert container
to the body.
The last message being
dismissed will remove the alert container
. A typical call sequence might look like:
var alert = new QfqNS.Alert({
message: "Text being displayed",
type: "info"
});
alert.show();
Messages may have different background colors (severity levels), controlled by the
type
property. Possible
values are
"info"
"warning"
"error"
The values are translated into Bootstrap alert-*
classes internally.
If no buttons are configured, a click anywhere on the alert will close it.
Buttons are configured by passing an array of objects in the buttons
property. The
properties of the object
are as follows
{
label: <button label>,
focus: true | false,
eventName: <eventname>
}
You can connect to the button events by using
var alert = new QfqNS.Alert({
message: "Text being displayed",
type: "info",
buttons: [
{ label: "OK", eventName: "ok" }
]
});
alert.on('alert.ok', function(...) { ... });
Events are named according to alert.<eventname>
.
If the property modal
is set to true
, a kind-of modal alert will be
displayed, preventing clicks
anywhere but the alert.
For compatibility reasons, the old constructor signature is still supported but deprecated
var alert = new QfqNS.Alert(message, type, buttons)
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | option object having following properties Properties
|
Methods
(private) afterFadeIn()
(private) buttonHandler(handler)
Parameters:
Name | Type | Description |
---|---|---|
handler |
(private) countAlertsInAlertContainer() → {number|jQuery}
Returns:
- Type
- number | jQuery