Child pages
  • Using External JavaScript
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Current »

It's possible to use any valid browser JavaScript API in Servoy mobile.

For example to show a default browser alert dialog, one can use:

alert('Hello World')

Using External JavaScript Libraries

With Servoy Mobile, 3rd party JavaScript plugins/libraries can be easily integrated in an app. Here are the steps to achieve this:

  • in Servoy Developer add all the jscss files of the 3rd party plugin as Media; all the jscss files from this folder will be added to the mobile page;
  • if the plugin requires static html content already on the page, this can be done by placing a bean on the form, that is actually an empty div, and setting its text property with the static (html) content;
  • another useful function that can be used when integrating 3rd party plugins is that from the mobile plugin: plugins.mobile.getMarkupId(), used for retrieving the document markup id for the elements of a Servoy form and customizing them; which is then usable in calls like document.getElementById()
  • 3rd party plugins initialization code should be placed inside the form's onShow callback that is called after the page is displayed; for example:
function onShow(event)
{
 var options = {
 	drawOnly : true
 };
 var api = $('.sigPad').signaturePad(options);
 api.regenerate(foundset.orders_to_deliveries.signature);
}

Full Example

This is a sample, its like a Fedex/UPS delivery app, that uses a JQuery based signature library to display a signature field: (checkout with SVN)
https://subversion.servoy.com/examples/MobileDeliverySample/trunk

  • No labels