LoginSignup
0
0

More than 5 years have passed since last update.

データを画面上に表示するには

Posted at

概要

データベース上の値を表示するには data-wao-bind 属性を使用します。

材料

変換元html
<!--データ取得-->
<form data-wao-action="/employee/detail/">
  <input type="hidden" name="id" data-wao-param="url">
</form>
<!--データ表示-->
<div data-wao-bind-class="dept_`employee.dept_id`">
  <div data-wao-bindouter="employee.name">Name</div>
</div>
アクセスURL

http://FQDN/employee/detail/id/123/

employeeテーブルの中身
id dept_id name
123 45 John

できあがり

変換後html
<div class="dept_45">John</div>

書式

bindの種類

属性名 説明
data-wao-bind- attribute attribute で指定された属性の値を上書き更新する
data-wao-prepend- attribute attribute で指定された属性値の前方に指定された値を追加する
data-wao-apend- attribute attribute で指定された属性値の後方に指定された値を追加する
data-wao-bindouter 属性を持つ親タグを削除して、その箇所に指定された値を出力する
data-wao-bindinner 属性を持つ親タグのinnerHtmlを指定された値に書き換える
data-wao-prependinner 属性を持つ親タグのinnerHtmlの前方に指定された値を追加する
data-wao-apendinner 属性を持つ親タグのinnerHtmlの後方に指定された値を追加する

属性値

_DB.table_name.column_name
table_name.column_name
column_name
デフォルト:escape
エスケープさせない場合はカラム名の先頭に@をつける
@@とするとタグだけを削除
|substr(128)
|substr(4,100)
|left(50)
|right(50)

table_name.column_name|raw|left(50)
updated_datetime|DATE(yyyy-MM-dd)
total_count|FORMAT(#,##0)

付録

関連項目

aaa

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0