【发布时间】:2018-06-26 07:21:39
【问题描述】:
所以我有这个数据:
data = [{
"D": 1,
"VALID": "N",
"NUMBER": "7064089-14-1607"
}, {
"D": 3,
"VALID": "N",
"NUMBER": "7064089-24-1106"
}, {
"D": 5,
"VALID": "N",
"NUMBER": "7066097-14-1508"
}]
在 extjs 中传递给 store。
fields: [{name: 'NUMBER', type: 'string'},{name: 'VALID', type: 'string'},{name: 'D', type: 'string'}]
这是我在 ExtJS 中的 tpl 代码:
tpl: [
'<div class="row">',
'<div class="column" style="width: 125px">',
'<h4>NUMBER </h4>',
'<tpl for =".">',
'<p>{NUMBER}</p>',
'</tpl>',
'</div>',
'<div class="column" style = "width: 100px">',
'<h4>VALID </h4>',
'<tpl for =".">',
'<p>{VALID}</p>',
'</tpl>',
'</div>',
'<div class="column">',
'<th></th>',
'<tpl for =".">',
'<p>{D}</p>',
'</tpl>',
'</div>',
'</div>'
]
如果在 D 上迭代的值大于 1,我有什么办法可以在 tpl for tag 中放置一个 tpl?
例如要转移到ExtJStpl的代码:
for i in D:
if i >1:
'<td class="gray">i</td>'
else:
'<td class="red">i</td>'
【问题讨论】:
-
你能进一步解释你的意思吗? “在标签内放一个”是什么意思?
标签: javascript extjs extjs4.1 extjs4.2