ASP.NET 中带有嵌套 JTemplate 的 JQuery
是否可以使用 JQuery/JTemplates/ASP.NET 实现这样的嵌套 UI?
或多或少的伪代码:重要的部分是 td 内的第二个 foreach 循环。
<table>
<thead style="font-weight: bold">
<tr>
<td>{$P.lang['pupilName']}</td>
<td>{$P.lang['mail']}</td>
</tr>
</thead>
<tbody>
{#foreach $T.table as record}
<tr>
<td>{$T.record.name}</td>
<td>{$T.record.mail}</td>
<td> // thats the 3rd column containing a listbox/list with documents
{#foreach $T.table1 as doc}
<ul>
<li>excel sheet 1</li>
<li>word document 2</li>
<li>pdf document 4</li>
</ul>
{#/for}
</td>
</tr>
{#/for}
</tbody>
</table>
Is it possible to have such a nested UI with JQuery/JTemplates/ASP.NET ?
more or less pseudo-code: The important part is the 2nd foreach loop inside the td.
<table>
<thead style="font-weight: bold">
<tr>
<td>{$P.lang['pupilName']}</td>
<td>{$P.lang['mail']}</td>
</tr>
</thead>
<tbody>
{#foreach $T.table as record}
<tr>
<td>{$T.record.name}</td>
<td>{$T.record.mail}</td>
<td> // thats the 3rd column containing a listbox/list with documents
{#foreach $T.table1 as doc}
<ul>
<li>excel sheet 1</li>
<li>word document 2</li>
<li>pdf document 4</li>
</ul>
{#/for}
</td>
</tr>
{#/for}
</tbody>
</table>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嵌套 for-each 应该是可能的:请参阅 这篇文章说明了该示例。
我在您的代码中看到的唯一问题是,我认为该行
应该类似于
,即您需要为父表中的每条记录引用嵌套表。
Nested for-each should be possible: see this article that illustrates the example.
Only issue that I see with your code is that I believe that line
should be something like
i.e. you need to refer to a nested table for each record in parent table.