ここに示されているのは、剣道 jquery スケジューラーの良いデモです http://demos.telerik.com/kendo-ui/web/scheduler/index.html
私の質問は: 日付ヘッダー セル (つまり、日付を含む各行の左側のセル) の色を変更することは可能ですか? たとえば、最初の 8 時間は緑、次の 8 時間は赤、すぐ
ここに示されているのは、剣道 jquery スケジューラーの良いデモです http://demos.telerik.com/kendo-ui/web/scheduler/index.html
私の質問は: 日付ヘッダー セル (つまり、日付を含む各行の左側のセル) の色を変更することは可能ですか? たとえば、最初の 8 時間は緑、次の 8 時間は赤、すぐ
上部のツールバーに日付ヘッダー セルが表示されます。あなたが話しているのは、時間ヘッダーセルです。
構成オプションはないと思います-次のmajorTimeHeaderTemplate
ように使用してみてください:
window.colors = ["lightblue", "lightgreen", "lightgrey"];
var template = "<div style='height:100%; width: 100%; background-color: " +
"# var color = window.colors[Math.floor(date.getHours() / 8)]; # " +
"#= color #;'><strong>#=kendo.toString(date, 'hh:mm')#</strong></div>";
$("#scheduler").kendoScheduler({
date: new Date("2013/6/6"),
majorTimeHeaderTemplate: kendo.template(template),
dataSource: [{
id: 1,
start: new Date("2013/6/6 08:00 AM"),
end: new Date("2013/6/6 09:00 AM"),
title: "Interview"
}]
});
(デモ)
残念ながら、テンプレートを使用してコンテナーのスタイルを変更することはできないため、空白が気に入らない場合は、.xml のソース コードを変更する必要がありますkendo.ui.DayView.fn._layout
。関連する抜粋のみをここに貼り付けます - アイデアは、時間に応じて行に別のクラスを追加することです:
this._forTimeRange(this.startTime(), this.endTime(), function (date, majorTick, middleRow, lastSlotRow) {
var template = majorTick ? that.majorTimeHeaderTemplate : that.minorTimeHeaderTemplate;
var colorClass = window.colors[Math.floor(date.getHours() / 8)];
var row = {
text: template({
date: date
}),
className: lastSlotRow ? "k-slot-cell" : ""
};
row.className += colorClass; // we can then style the row using this selector
rows.push(row);
});
(デモ)
他のビュー タイプにも同様のアプローチを使用できます。
CSSでそれを行うことができるはずです。何かのようなもの:
.k-scheduler-times tr:nth-child(-n+8)
{
background-color: green;
}
.k-scheduler-times tr:nth-child(n+9):nth-child(-n+16)
{
background-color: red;
}