최신 웹 개발 튜토리얼
 

AppML사례 연구 - 카테고리


html로 페이지

이것은 HTML 소스입니다 :

<!DOCTYPE html>
<html lang="en-US">
<title>Categories</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="http://www.w3ii.com/appml/2.0.3/appml.js"></script>
<body>

<div class="container">
<h1>Categories</h1>

<div id="Form01" class="jumbotron" style="display:none" appml-data="local?model=model_categoriesform" appml-controller="myFormController">
  <div appml-include-html="inc_formcommands.htm"></div>
  <div class="form-group">
    <label>CategoryName:</label>
    <input id="CategoryName" class="form-control">
  </div>
  <div class="form-group">
    <label>Description:</label>
    <input id="Description" class="form-control">
  </div>
</div>

<div appml-data="local?model=model_categorieslist">
  <div appml-include-html="inc_listcommands_nofilter.htm"></div>
  <table class="table table-striped table-bordered">
  <tr>
    <th></th>
    <th>Category</th>
    <th>Description</th>
  </tr>
  <tr appml-repeat="records">
    <td style="cursor:pointer"
    onclick="appml('Form01').run({{CategoryID}})">
    <span class="glyphicon glyphicon-edit"></span>
    </td>
    <td>{{CategoryName}}</td>
    <td>{{Description}}</td>
    </tr>
  </table>
</div>

</div>

<script>
function myFormController($appml) {
    if ($appml.message == "ready") {return -1;}
    if ($appml.message == "loaded") {
        document.getElementById("Form01").style.display = "";
    }
}
</script>

</body>
</html>
PHP» 닷넷»

모델

이 응용 프로그램에 사용되는 모델입니다 :

목록 모델

{
"database" : {
"connection" : "localmysql",
"sql" : "SELECT * FROM Categories"
}
}

양식 모델

{
"database" : {
"connection" : "localmysql",
"sql" : "SELECT * FROM Categories",
"maintable" : "Categories",
"keyfield" : "CategoryID"
},
"updateItems" : [
{"item" : "CategoryName"},
{"item" : "Description"}
]
}