NV速度问题
我接管了使用 NVelocity 模板的现有系统的一些工作。它迭代一些数据行,然后循环创建一个 html 数据表的字段。我想更改此设置,以便某些表格单元格包含来自不同字段的数据。
这是它的工作原理:
#if($data.Count > 0)
#set ($end = $data.Count - 1)
#foreach($count in [0 .. $end])
<tr class="$!class $!alerts $!status">
#set($colcount = 0)
#foreach($field in $fields)
<td class="$!colclass">
$data.GetData($count, $field)
</td>
#end
</tr>
#end
#end
我希望它做这样的事情:
#if($data.Count > 0)
#set ($end = $data.Count - 1)
#foreach($count in [0 .. $end])
<tr class="$!class $!alerts $!status">
#set($colcount = 0)
#foreach($field in $fields)
#if($field.Name=="JourneyAlias")
$data.GetData($count, $field) - $data.GetData($count, 'JourneyId')
#else
<td class="$!colclass">
$data.GetData($count, $field)
</td>
#end
#end
</tr>
#end
#end
简而言之,我想知道如何从数据访问 JourneyId 字段
I have taken over some work on an existing system that uses NVelocity templates. It iterates though some rows of data and then loops though the fields creating an html table of the data. I want to change this so that some of the table cells contains data from a different field.
here is how it works:
#if($data.Count > 0)
#set ($end = $data.Count - 1)
#foreach($count in [0 .. $end])
<tr class="$!class $!alerts $!status">
#set($colcount = 0)
#foreach($field in $fields)
<td class="$!colclass">
$data.GetData($count, $field)
</td>
#end
</tr>
#end
#end
What I want it to do something like this :
#if($data.Count > 0)
#set ($end = $data.Count - 1)
#foreach($count in [0 .. $end])
<tr class="$!class $!alerts $!status">
#set($colcount = 0)
#foreach($field in $fields)
#if($field.Name=="JourneyAlias")
$data.GetData($count, $field) - $data.GetData($count, 'JourneyId')
#else
<td class="$!colclass">
$data.GetData($count, $field)
</td>
#end
#end
</tr>
#end
#end
In short I want to know how to access the field JourneyId from the data
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
排序了我需要这个语法的问题:
Sorted the issue I needed this syntax: