質問編集履歴
2
問題のコード追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -50,4 +50,48 @@
|
|
50
50
|

|
51
51
|
rowspanに入っている値は共に2だと考えられるため、現状原因がわからない状態です。
|
52
52
|
変数を入れた場合にうまくいかない原因について教えていただきたいです。
|
53
|
-
よろしくお願いします。
|
53
|
+
よろしくお願いします。
|
54
|
+
|
55
|
+
# 追記
|
56
|
+
うまくいかなかった場合のコードです。
|
57
|
+
```ここに言語を入力
|
58
|
+
let schedule_Html = `<caption class="schedule_title">${day + '日'}</caption>`;
|
59
|
+
schedule_Html += `<tr style="text-align: center;">`;
|
60
|
+
// 予約状況テーブルのカラム作成
|
61
|
+
schedule_Html += `<td class="schedule_columns" width=200>${schedule_tb_columns[0]}</td>`;
|
62
|
+
schedule_Html += `<td class="schedule_columns" width=250>${schedule_tb_columns[1]}</td>`;
|
63
|
+
schedule_Html += `<td class="schedule_columns" width=255>${schedule_tb_columns[2]}</td>`;
|
64
|
+
schedule_Html += `</tr>`;
|
65
|
+
|
66
|
+
schedule_Html += '<tbody class="scroll">';
|
67
|
+
var flag = 0;
|
68
|
+
for (let i=0; i < time_schedule.length; i++){
|
69
|
+
schedule_Html += '<tr style="text-align: center;">';
|
70
|
+
schedule_Html += `<td class="schedule_time_td" width=200>${time_schedule[i]}</td>`;
|
71
|
+
var rowspan_index = 2;
|
72
|
+
if (day_schedule[i][1] == "1"){
|
73
|
+
if (flag > 0){
|
74
|
+
// 結合したrow数分減らす
|
75
|
+
flag -= 1;
|
76
|
+
}
|
77
|
+
else if (day_schedule[i][0] == null){
|
78
|
+
schedule_Html += `<td class="schedule_time_td" width=250></td>`;
|
79
|
+
schedule_Html += `<td class="schedule_time_td" width=255></td>`;
|
80
|
+
}
|
81
|
+
else if (day_schedule[i][0] != null){
|
82
|
+
schedule_Html += `<td class="schedule_time_td" width=250>${day_schedule[i][0] + '様'}</td>`;
|
83
|
+
schedule_Html += `<td class="schedule_time_td" width=255>${day_schedule[i][2]}</td>`;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
else{
|
87
|
+
// 時間表記部分のindexを作成
|
88
|
+
if (flag == 0){
|
89
|
+
schedule_Html += `<td rowspan=rowspan_index class="schedule_time_td" width=250>${day_schedule[i][0] + '様'}</td>`;
|
90
|
+
schedule_Html += `<td rowspan=rowspan_index class="schedule_time_td" width=255>${day_schedule[i][2]}</td>`;
|
91
|
+
flag = day_schedule[i][1]-1;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
schedule_Html += '</tr>';
|
95
|
+
}
|
96
|
+
schedule_Html += '</tbody>';
|
97
|
+
```
|
1
変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -42,7 +42,8 @@
|
|
42
42
|
schedule_Html += '</tbody>';
|
43
43
|
return schedule_Html;
|
44
44
|
```
|
45
|
-
上記リストのday_scheduleは二次元配列となっていて、[予約者名、施術時間(何セル分か)、メニュー名]が保存されています。
|
45
|
+
上記リストのday_scheduleは二次元配列となっていて、各要素に[予約者名、施術時間(何セル分か)、メニュー名]が保存されています。
|
46
|
+
([[予約者名、施術時間(何セル分か)、メニュー名], [予約者名、施術時間(何セル分か)、メニュー名], ...])
|
46
47
|
上記のようにrowspanの値を数字にすると以下の画像のようにイメージ通りの出力となります。
|
47
48
|

|
48
49
|
しかし、rowspanの値を変数(上記のプログラムではrowspan_index)にした場合名前、メニューの蘭が以下の画像のようにずれてしまいます。
|