...
Open the /sports-webui/ClientLogic/ folder in VS Code. Open Order/getOrderForeignKeys.js from the Explorer view (see picture below).
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.
- Replace
self
witheventSource: akioma.swat.SwatObject
.
Note that the function parameter 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. - Replace
getObject("CustomerDetailsForm")
withgetForm("CustomerDetailsForm")
andgetObject("CustomerGrid")
withgetGrid("CustomerGrid")
.
The CLA supports generic traversing functions like getObject(), getLink() etc. which return the generic base SwatObject class object.
The CLA also supports type specific traversing function like getForm(), getGrid(), getRibbon() etc. to avoid casting.
Alternatively you can use TypeScript casting. For example: (eventSource.getObject("MyObject") as akioma.swat.Form). - Replace
getValue
withgetDataValue
.
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).
...