Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

TypeScript compiles to plain JavaScript. The compiled JavaScript code looks almost exactly the same as the TypeScript source code without the typings (when compiling to ES6 and beyond).

...

  1. Replace 

    if (akioma.samples)
    akioma.samples = {};
    akioma.samples.getOrderForeignKeys = function(self) {

    With

    namespace akioma.samples {
        export function getOrderForeignKeys(self) { 

    Use namespaces to avoid naming conflicts. Note that functions must be exported to be used outside the namespace.

  2. Replace self with eventSource: akioma.swat.SwatObject.

    Note that the function parameter name does not have to be eventSource. For example: eventGrid eventForm, eventRibbon etc. Although self might be confusing with the JavaScript dynObject.

    Note that the function parameter type does not have to be the generic base SwatObject as in this case. Use the correct Object Type class to avoid casting.

  3. Replace getObject("CustomerDetailsForm") with getForm("CustomerDetailsForm")getObject("CustomerGrid") with getGrid("CustomerGrid") and container with window.

    The CLA supports generic traversing functions like getObject(), getLink() etc. which return the generic base SwatObject class object.

    The CLA also supports type specific function like getForm(), getGrid(), getRibbon() etc. to avoid casting.

    Alternatively you can use TypeScript casting. For example: (eventSource.getObject("MyObject") as akioma.swat.Form).

  4. Replace getValue with getDataValue.

    The Form and Grid classes have both a getScreenValue() and getDataValue() functions for getting the field screen value or record value respectively.

    Save (Ctrl-S) and rename (F2) the file as Order/getOrderForeignKeys.ts using the .ts TypeScript file extension (see picture below).

Documentation

In addition to the intellisense of the class methods, properties and their explanation

you can find the documentation for the complete list of CLA TypeScript classes, their methods and properties in the link below -

https://<your environment domain>/docs2

Image Added

Calling JavaScript functions from TypeScript

...