JSUtilDialogs

From GeoMedia Smart Client
Jump to: navigation, search
GMSC 2013/2014 Javascript API Overview Form Events Types Utility Functions client-side Validation Conditions Interaction with SmartClient Cookbook Cheatsheet
Utility Functions Request and URL Handling Localisation Dialogs & Notification Workflow Utility Functions


Notification Dialogs

The different IGForm dialog classes allow you to notify the user about ongoing events or prompt him for input. Another use case would be to block the user interface during long-running tasks (i.e. execution of server-side triggers).

You should use these dialogs instead of the native Javascript dialogs (e.g. alert, prompt, confirm), since the native dialogs block the script execution while they are open. GMSC 2013

IG.Busy (options)

a UI-blocking dialog for preventing user input during long-running server tasks (e.g. trigger execution) GMSC 2013

Busydialog.png

Parameters

{Object} options the options for configuring the dialog. The default options are:

 var defaultOptions = {
     showIsLoading: true, //show preloader icon?
     message: "Please wait...", //dialog message
     title: "Form is currently busy" //dialog header
 };

Returns

{Object} IG.Busy dialog object the class instance of the generated Busy dialog. Provides a close method to close the dialog.

Example

Show a IG.Busy dialog while an AJAX request is performed and close it as soon as the request finishes or fails:

var busyDialog = IG.Busy({
    message: 'Sending an ajax request'
});
IG.url('Workflow/Index/').ajaxPost().always(function () {
    busyDialog.close()
})

IG.notify (message, options)

Notify.png

a non-blocking notification message displayed on top of the page, can be used to notifiy the user about form completion errors, results of long-running tasks etc. GMSC 2013

Parameters

{String} message the message that should be displayed

{Object} options the options for configuring the message. The default options are:

var defaultOptions = {
    delay: 5000,   //fade out delay in milliseconds, only effective with fadeOut: true
    fadeOut: false, // fade the message out after the given delay
    autoFocus: true,  //automatically focus the inserted message (includes a page scroll to the message)
    hidePrevious: true //hide previously inserted messages
}

Returns

{Object} IG.Notify message object the class instance of the generated notify message. Provides hide() and show() methods for display control

Example

show an IG.notify message and fade it out after 7 seconds

IG.notify("this message will go awain in 7 secs", {fadeOut: true, delay:7000}).show()

IG.Confirm (options)

Confirm.png

a blocking dialog that asks the user to confirm a certain action. GMSC 2013

Parameters

{Object} options the options for configuring the dialog. The default options are:

 var defaultOptions = {
     title: "Confirm", //dialog title
     message: "Are you sure?", //dialog message
     okMessage: "Yes", // label of the OK-Button
     cancelMessage: "No", //label of the cancel button
     callback: null //callback function that gets executed once the user clicks the OK-Button
 };

Examples

Basic confirm dialog with default attributes:

	IG.confirm();


Basic confirm dialog with custom title and message:

	IG.confirm({title: 'Deleting attached file', message: 'Do you really want to delete this file?'});


Custom delete confirmation message:

	var myCallBackFunction = function () { 
		console.log('callback is called'); 
	};
 
	IG.confirm({callback: myCallBackFunction});
IG.confirm({
    message: "Do you really want to delete the Query?",
    title: "Confirm",
    okMessage: "Yes",
    cancelMessage: "No",
    callback: function () {
        IG.remove({
            follownode: 2
        });
    }
});