အက် ပ် ML အ ကိုးအကား


AppML HTML ရည်ညွှန်းချက်များ

ဥပမာ

<div appml-include-html="inc_header.htm"></div>

<h1>Customers</h1>
<table appml-data="customers.js" appml-controller="myController">
  <tr>
    <th>Customer</th>
    <th>City</th>
    <th>Country</th>
  </tr>
  <tr appml-repeat="records">
    <td>{{CustomerName}}</td>
    <td>{{City}}</td>
    <td>{{Country}}</td>
  </tr>
</table>

<div appml-include-html="inc_footer.htm"></div>
Attribute Description Explained
appml-controller Defines an AppML controller AppML Controllers
appml-data Defines the data source for an application AppML Data
appml-include-html Defines HTML to be included AppML Includes
appml-repeat Defines an HTML element to be repeated AppML Howto

AppML မက်ဆေ့ချ်များ

ဥပမာ

function myController($appml) {
    if ($appml.message == "display") {
        if ($appml.display.name == "CustomerName") {
            $appml.display.value = $appml.display.value.toUpperCase();
        }
    }
}
Message Sent
ready After AppML is initiated, and ready to load data.
loaded After AppML is fully loaded, ready to display data.
display Before AppML displays a data item.
done After AppML is done (finished displaying).
submit Before AppML submits data.
error After AppML has encountered an error.

AppML မက်ဆေ့ချ်များကို AppML မက်ဆေ့ချ် များအကြောင်း အခန်းတွင် ရှင်းပြ ထားသည်။


AppML မော်ဒယ်များ

ဥပမာ

{
"security": "admin",
"rowsperpage" : 10,

"database": {
    "connection": "mysql",
    "sql"       : "SELECT * FROM Customers",
    "orderby"   : "CustomerName"}},

"filteritems" : [
    {"item" : "CustomerName", "label" : "Customer"},
    {"item" : "City"},
    {"item" : "Country"}],

"sortitems" : [
    {"item" : "CustomerName", "label" : "Customer"},
    {"item" : "City"},
    {"item" : "Country"}]
}

AppML Model Properties

Element Description
"data" Defines a flat file source for the model
"database" Defines a database source for the model
"filteritems" Defines filter restrictions
"rowsperpage" Defines number of rows to be fetched per page
"security" Defines the security for the model
"sortitems" Defines sorting restrictions

လျှောက်လွှာလုံခြုံရေး

ဤအပလီကေးရှင်းကိုဝင်ရောက်ရန် သင်သည် "စီမံခန့်ခွဲသူ" အဖွဲ့၏အဖွဲ့ဝင်တစ်ဦးအဖြစ် အကောင့်ဝင်ရပါမည်-

ဥပမာ

{
"security": "admin",
"database": {
    "connection": "mysql",
    "sql"       : "SELECT * FROM Customers",
    "orderby"   : "CustomerName"}
}

သီးသန့်မော်ဒယ်များ

မော်ဒယ်သို့ သင့်ကိုယ်ပိုင် သီးသန့်ဒေတာကို ထည့်သွင်းနိုင်သည်။

ဤဥပမာသည် ဒေတာကန့်သတ်ချက်များကို အကြံပြုသည်-

ဥပမာ

"restrictions" : {
    "fname" : {"maxlength": 40},
    "price" : {"max": 999,"min": 100}
    }

မော်ဒယ်ဒေတာကို ဆာဗာအပလီကေးရှင်းများနှင့် သင်၏ AppML ထိန်းချုပ်ကိရိယာမှ အသုံးပြုနိုင်သည်။

ဤဥပမာသည် ထည့်သွင်းမှုကို အတည်ပြုရန် မော်ဒယ်ဒေတာကို အသုံးပြုသည်-

ဥပမာ

function myController($appml) {
    if ($appml.message == "submit") {
        var price = document.getElementById("price").value;
        if (price < $appml.model.restrictions.price.min) {
            $appml.displayError(15, "Price too low!");
            return;
        }
}