の
テーブルをt
にします。
q)t
a b c d result
-------------------
94 66 8 82 success
8 24 62 47 failed
97 60 95 26 success
52 69 59 93 success
HTML td
要素の属性の対応表at
してください。属性がない場合は、空の辞書から始めます。空の辞書は()!()
です。
q)show at:flip (cols t)! (count each(cols t;t))#enlist()!()
a b c d result
------------------------------
()!()()!()()!()()!()()!()
()!()()!()()!()()!()()!()
()!()()!()()!()()!()()!()
()!()()!()()!()()!()()!()
t
のresult
列に従ってat
のresult
列を更新します。
q)f:t[`result]=`failed
q)update result:([]color:(sum f)#enlist"red")from `at where f
q)at
a b c d result
----------------------------------------
()!()()!()()!()()!()()!()
()!()()!()()!()()!() (,`color)!,"red"
()!()()!()()!()()!()()!()
()!()()!()()!()()!()()!()
.h.htac
を使用して、表のセルに属性辞書をマークアップできます。まず文字列としての表のセル:
q)string t cols t
"94" ,"8" "97" "52"
"66" "24" "60" "69"
,"8" "62" "95" "59"
"82" "47" "26" "93"
"success" "failed" "success" "success"
二度と頭を下げていないことに気をつけてください。今度はat
の辞書もまた反転しました。
q)at cols t
()!()()!() ()!()()!()
()!()()!() ()!()()!()
()!()()!() ()!()()!()
()!()()!() ()!()()!()
()!() (,`color)!,"red"()!()()!()
我々は.h.htac
のそれぞれ第2および第1引数としてこれらを使用することができます。 each-both adverbは対応する行を反復処理しますが、対応するセルが必要なので、.h.htac''
は行内のセル内で反復処理します。がハイライト表示、またはクライアント - のIDを提供するすべての種類に適合させることができる強力な技術である属性辞書のテーブルを使用して
markup:{[t]
th:.h.htc[`tr;]raze .h.htc[`th;] each string cols t; /table head
at:flip (cols t)! (count each(cols t;t))#enlist()!(); /empty attribute dictionaries
f:t[`result]=`failed;
at:update result:([]color:(sum f)#enlist"red")from at where f; /attributes for result failed
tr:.h.htc[`tr;]each raze each flip .h.htac''[`td;at cols t;string t cols t]; /table rows
.h.htc[`table;] .h.htc[`thead;th],.h.htc[`tbody;raze tr]
}
:
q).h.htac''[`td;at cols t;string t cols t]
"<td>94</td>" "<td>8</td>" "<td>97</td>" "<td>52..
"<td>66</td>" "<td>24</td>" "<td>60</td>" "<td>69..
"<td>8</td>" "<td>62</td>" "<td>95</td>" "<td>59..
"<td>82</td>" "<td>47</td>" "<td>26</td>" "<td>93..
"<td>success</td>" "<td color=\"red\">failed</td>" "<td>success</td>" "<td>su..
機能markup
はHTML table
要素を組み立てますサイドスクリプト。
あなたは何をしたいですか? –
赤い色の表で "失敗"という単語を強調表示したいと思います。 – Terry
あなたは簡単にブートストラップアラートを使ってこれを行うことができます! –