0
<table>
<tr>
<td rowspan="2">test</td>
<td>test</td>
</tr>
<tr>
<td rowspan="0">test</td>
<td>test</td>
</tr>
</table>
$.each(data.shopTimeArray,function(i)
{
$tbodyTR = $("<tr>",{}).appendTo($tbody);
$tbodyTH = $("<th>",{'scope':'row','html':data.shopTimeArray[i].slice(0,-3)}).appendTo($tbodyTR);
$.each(data.workerids,function(j)
{
$.each(data.workerAppointments[data.workerids[j]],function(k)
{
if(data.workerAppointments[data.workerids[j]][k].timeArray != "undefined") {
$.each(data.workerAppointments[data.workerids[j]][k].timeArray,function(y){
$rowSpan++;
});
} else {
$rowSpan = 0;
}
});
});
$tbodyTD = $("<td>",{'class':classname,'onclick':click,'html':html,'rowspan':$rowSpan,'data-time':time,'workerid':data.workerids[j]}).appendTo($tbodyTR);
});
{"shopTimeArray":["10:00:00","10:15:00","10:30:00","10:45:00","11:00:00","11:15:00","11:30:00","11:45:00","12:00:00"],"workernames":["Kapper 1","Kapper 2"],"workerTimes":{"148":["10:00:00","10:15:00","10:30:00","10:45:00","11:00:00","11:15:00","11:30:00","11:45:00","12:00:00"],"196":["10:00:00","10:15:00","10:30:00","10:45:00","11:00:00","11:15:00","11:30:00","11:45:00","12:00:00"]},"workerAppointments":{"148":[{"timeArray":["10:00:00","10:15:00","10:30:00","10:45:00"]}],"196":[{"timeArray":["09:30:00","09:45:00"]},"workerids":["148","196"],"today":"2017-06-19","dayname":"1"}
這裏即時創建動態HTML,行跨度不是通過jQuery工作動態生成HTML內容正確
我想跳過未來5 TD是否有行跨度= 5
值要跳過在workerAppointments [workerid] [timearray]
尋找幫助
https://imgur.com/a/xCais 「提示」
看看我添加的表是由jQuery生成的,你可以在表中看到如果rowspan = 2比在下一個tr首先td不會添加,但通過我上面的jQuery代碼添加創建像上表。
無論這段代碼也不是這問題對我有意義。請清楚解釋問題是什麼以及理想的輸出是什麼樣子。 –
嗨,我只是上傳圖像的問題,它是顯示意想不到的結果,我想跳過td,如果有rowspan可用 –
甚至沒有圖像是有道理的。請嘗試解釋你想要做的方式,每個人都會能夠理解 –