mysql - creating routine table for given array -
i have follwing data:
[[subject1,day1,time 1]],[subject2,day1,time2]]
and want table structure as
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>
whats wrong in table structure?it displaying same subject in every column..help
from glance, looks have move <td>
inside <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>
or simply:
<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>
Comments
Post a Comment