gpt4 book ai didi

mysql - 为给定数组创建例程表

转载 作者:行者123 更新时间:2023-11-30 00:29:39 25 4
gpt4 key购买 nike

我有以下数据:

[[subject1,day1,time 1]],[subject2,day1,time2]]

我想要表结构为

        time 1          time 2
Sunday subject1 Subject 2
Monday subject1 Subject 2

<table id="routineClassTable" class="table table-condensed">
<thead><tr>
<td></td>
<g:each in="${routineTime}" var="r">
<td class='${r.id}'>${r.timetable.startTime.format("hh:mm")}-${r.timetable.endTime.format("hh:mm")}</td>
</g:each>
</tr>
</thead>
<g:each var='d' in='${day}'>
<tr>
<td class='${d}'>${d}</td>
<g:each in="${routineTime}" var="rt">

<g:each in="${subject}" var="sub">

<g:if test="${sub[1]!=''}"><g:set var="value" value="${sub[0]}"></g:set> </g:if>
<g:else>--</g:else>

</g:each>

<td class="${d}${rt.id}"> ${value}
</td>
</g:each>
</tr>
</g:each>
</table>

这个表结构有什么问题?它在每一列中显示相同的主题..help

最佳答案

乍一看,你得搬家了<td>里面<g:each> :

<g:each in="${routineTime}" var="rt">
<g:each in="${subject}" var="sub">
<g:if test="${sub[1]!=''}">
<g:set var="value" value="${sub[0]}"></g:set>
</g:if>
<g:else>--</g:else>

<!-- Display each subject-->
<td class="${d}${rt.id}"> ${value}</td>
</g:each>
</g:each>

或者简单地说:

<g:each in="${routineTime}" var="rt">
<g:each in="${subject}" var="sub">
<g:if test="${sub[1]}">
<!-- Display each subject-->
<td class="${d}${rt.id}"> ${sub[0]}</td>
</g:if>
<g:else>
<td class="${d}${rt.id}"> --</td>
</g:else>
</g:each>
</g:each>

关于mysql - 为给定数组创建例程表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22605355/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com