AppML API
Die AppML API definieer die metodes en eienskappe van AppML
Wat kan metodes en eienskappe doen?
Met metodes en eienskappe kan jy:
- Skep AppML-toepassings
- Voer toepassings met data
- Haal toepassingsdata vir gebruik in jou webblad
Voorbeeld
new AppML() skep 'n nuwe AppML-objek.
dataSource stel die databron van die AppML-voorwerp.
getData() kry die data.
data.records bevat die datarekords.
Jy kan die rekords lus en die inhoud in 'n HTML-element vertoon:
Voorbeeld
// Create an AppML object and fetch the data
myObj = new AppML();
myObj.dataSource = "https://www.w3schools.com/appml/customers.php";
myObj.getData();
// Locate the data records
myArr = myObj.data.records;
len = myArr.length;
// Display the records
for (i = 0; i < len; i++) {
txt += myArr[i].CustomerName + "<br>";
}
document.getElementById("demo").innerHTML = txt;
Resultaat
Alfreds Futterkiste
Berglunds snabbköp
Centro comercial Moctezuma
Ernst Handel
FISSA Fabrica Inter. Salchichas S.A.
Galería del
gastrónomo
Island Trading
Königlich Essen
Laughing Bacchus Wine
Cellars
Magazzini Alimentari Riuniti
North/South
Paris spécialités
Rattlesnake Canyon Grocery
Simons bistro
The Big Cheese
Vaffeljernet
Wolski Zajazd
Sommige AppML-metodes
Method | Description |
---|---|
new AppML() | Creates a new AppML object |
run() | Runs an application object |
appml("name") | Returns the appml object with the specified name |
displayMessage(text) | Displays a specified message. |
setError(no, description) | Sets a specified error and error description. |
Sommige AppML-eienskappe
Property | Description |
---|---|
appName | The application name (the container id) |
container | The application container element |
controller | The application controller |
data | The application data object |
dataSource | The application data source |
message | The application message |
Sommige data-objek-eienskappe
Property | Description |
---|---|
data.model | The application data model |
data.records | The application data records |