toExternal

Summary

Converts the model data to an external JavaScript format for view rendering.

Usage

public abstract external toExternal()

Description

Converts the data from an internal JS++ type to an external JavaScript type for view rendering. The view rendering depends on the Handlebars JavaScript library so the model data must be converted to a format that JavaScript understands.

This method must be overridden for view rendering to work.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import Altitude.Frontend;
 
class Employee : Model
{
    string firstName;
    string lastName;
 
    Employee(string firstName, string lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }
 
    override function toExternal() {
        return {
            "firstName": this.firstName,
            "lastName": this.lastName
        };
    }
}

Share

HTML | BBCode | Direct Link