Creating your own JavaScript controls using JSON

In Omnis Studio 8.1 you can now define your own remote form controls using JSON and JavaScript, and use them on JavaScript Remote forms in your web and mobile applications. Using the same technique, you can wrap ready-made JavaScript components available from any third-party, opening up endless possibilities for new controls to use in your Omnis apps.

This new method of creating JavaScript components provides an alternative to creating external components using C++ and our JavaScript SDK, which is the current method used for creating JavaScript components. It also means you only need to understand JSON and JavaScript, together with our JavaScript interfaces on the client, in order to create and use the new JSON defined JavaScript controls, either in your own web or mobile apps, or to provide to the wider Omnis community.

A JSON control is defined in a JSON file, called a JSON Control Definition (JCD) file, which you can create or edit using any text or JSON editor, or you can create JSON controls using a new tool in Studio 8.1 called the JSON Control Editor. Having built a JSON defined component, with all the necessary JSON and JavaScript files, and after restarting Omnis, the component will appear in the Component Store in a new JSON Components group, ready for you to use.

Using Ready-made JS Components

When using ready-made JS components, that you have obtained from a third-party, you need to add the .js file(s) to the html/scripts folder in the Omnis tree, and any other CSS and image files required for the control need to be put in the appropriate folder(s). You will also need to add any properties, methods, and events in your JS control to the JSON definition file via the JSON Control Editor.

There is a new tech note on the Omnis website that describes the process of using a ready-made JS component in Omnis: in the tech note we have taken a ready-made JS component which displays a Star rating, and created a JSON wrapper for it. The tech note is here:

  • TNJC0009: Adding Ready-made JavaScript components to Omnis

In order to create your own JS components, you will also need to refer to the JavaScript Control Reference in the JS SDK docs which you can find here on our new repo for Omnis SDK Docs:

http://sdkdocs.omnis.net/jssdk

The main docs for the new JSON controls, and many other new features added to Studio 8.1, are in the updated ‘Creating Web & Mobile Apps’ manual, which is here:

www.omnis.net/documentation/webdev/index.jsp?detail=04jsoncomps.html#chapter-4json-components

0 Comments

Leave a reply

© Omnis Software Ltd 2017 - Help with setup and design by Ädelfors Consult ABSweden Disclaimer: Omnis Software disclaims any responsibility for or liability related to Software, or any content or advice, obtained through this site. IN NO EVENT WILL OMNIS SOFTWARE BE LIABLE FOR ANY INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES HOWEVER THEY MAY ARISE AND EVEN IF OMNIS SOFTWARE HAS BEEN PREVIOUSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Log in with your credentials

or    

Forgot your details?

Create Account