Javascript 如何对齐资源列和事件列的行高?
我正在为我当前的项目开发KendoUI调度程序,当我在调度程序的resource列中添加图像时,我遇到了一个行高不匹配的问题。资源单元的高度与计划程序插槽的高度不一致 我试图通过使用CSS设置高度来实现这一点,但运气不好Javascript 如何对齐资源列和事件列的行高?,javascript,jquery,kendo-ui,telerik,kendo-scheduler,Javascript,Jquery,Kendo Ui,Telerik,Kendo Scheduler,我正在为我当前的项目开发KendoUI调度程序,当我在调度程序的resource列中添加图像时,我遇到了一个行高不匹配的问题。资源单元的高度与计划程序插槽的高度不一致 我试图通过使用CSS设置高度来实现这一点,但运气不好 $(function () { $("#scheduler").kendoScheduler({ date: new Date("2013/6/13"), startTime: new Date("2013/6/13 07:00 AM")
$(function () {
$("#scheduler").kendoScheduler({
date: new Date("2013/6/13"),
startTime: new Date("2013/6/13 07:00 AM"),
height: 600,
eventHeight: 10,
majorTick: 60,
RowHeight: 300,
//slotTemplate: "<div style='background:#=getColorBasedOnHour(date, JSON.stringify(data))#; height: 100%;width: 100%;'></div>",
views: [ {
type: "timelineMonth",
//type: "kendo.ui.TimelineNoGap",
//type: "kendo.ui.DayViewNoGap",
title: "TimelineMonth",
startTime: new Date("2013/6/13 00:00 AM"),
majorTick: 1440
},
"timelineWorkWeek", "timelineWeek", {
//type: "kendo.ui.DayViewNoGap",
minorTickCount: 4,
type: "kendo.ui.TimelineView",
//type: "timeline",
title: "Timeline",
}
],
timezone: "Etc/UTC",
dataSource: {
batch: true,
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/meetings",
dataType: "jsonp"
},
update: {
url: "https://demos.telerik.com/kendo-ui/service/meetings/update",
dataType: "jsonp"
},
create: {
url: "https://demos.telerik.com/kendo-ui/service/meetings/create",
dataType: "jsonp"
},
destroy: {
url: "https://demos.telerik.com/kendo-ui/service/meetings/destroy",
dataType: "jsonp"
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
schema: {
model: {
id: "meetingID",
fields: {
meetingID: { from: "MeetingID", type: "number" },
title: { from: "Title", defaultValue: "No title", validation: { required: true } },
start: { type: "date", from: "Start" },
end: { type: "date", from: "End" },
startTimezone: { from: "StartTimezone" },
endTimezone: { from: "EndTimezone" },
description: { from: "Description" },
recurrenceId: { from: "RecurrenceID" },
recurrenceRule: { from: "RecurrenceRule" },
recurrenceException: { from: "RecurrenceException" },
roomId: { from: "RoomID", nullable: true },
attendees: { from: "Attendees", nullable: true },
isAllDay: { type: "boolean", from: "IsAllDay" }
}
}
}
},
group: {
resources: ["Attendees"],
orientation: "vertical"
},
groupHeaderTemplate: $("#groupHeaderTemplate").html(),
resources: [
{
field: "attendees",
name: "Attendees",
dataSource: [
{ text: "Alex", value: 1, color: "#f8a398", image: "http://localhost:8080/car-rent-app/kendo/examples/content/chat/Doctor2.jpg" },
{ text: "Bob", value: 2, color: "#51a0ed", image: "http://localhost:8080/car-rent-app/kendo/examples/content/chat/Doctor3.jpg" },
{ text: "Charlie", value: 3, color: "#56ca85", image: "http://localhost:8080/car-rent-app/kendo/examples/content/chat/Doctor4.jpg" }
],
multiple: true,
title: "Attendees"
}
],
slotTemplate: "<div style='background:#=getColorBasedOnHour(date, JSON.stringify(event))#; height: 100%;width: 100%;'></div>"
});
<style>
.k-scheduler-timelineWeekview .k-scheduler-table td,
.k-scheduler-timelineview tr:nth-child(2) .k-scheduler-table td,
.k-scheduler-timelineview tr:nth-child(2) .k-scheduler-table th,
.k-scheduler-timelineWorkWeekview .k-scheduler-table td,
.k-scheduler-timelineMonthview .k-scheduler-table td {
height: 71px !important;
}
</style>
$(函数(){
$(“#调度程序”).kendoScheduler({
日期:新日期(“2013/6/13”),
开始时间:新日期(“2013/6/13 07:00 AM”),
身高:600,
活动高度:10,,
少校:60,
行高:300,
//slotTemplate:“”,
意见:[{
类型:“timelineMonth”,
//键入:“kendo.ui.TimelineNoGap”,
//键入:“kendo.ui.dayViewNoCap”,
标题:“TimelineMonth”,
开始时间:新日期(“2013/6/13 00:00 AM”),
少校:1440
},
“timelineWorkWeek”、“timelineWeek”{
//键入:“kendo.ui.dayViewNoCap”,
minorTickCount:4,
键入:“kendo.ui.TimelineView”,
//键入:“时间线”,
标题:“时间线”,
}
],
时区:“Etc/UTC”,
数据源:{
批次:对,
运输:{
阅读:{
url:“https://demos.telerik.com/kendo-ui/service/meetings",
数据类型:“jsonp”
},
更新:{
url:“https://demos.telerik.com/kendo-ui/service/meetings/update",
数据类型:“jsonp”
},
创建:{
url:“https://demos.telerik.com/kendo-ui/service/meetings/create",
数据类型:“jsonp”
},
销毁:{
url:“https://demos.telerik.com/kendo-ui/service/meetings/destroy",
数据类型:“jsonp”
},
parameterMap:功能(选项、操作){
if(操作!=“读取”&&options.models){
返回{models:kendo.stringify(options.models)};
}
}
},
模式:{
型号:{
id:“会议id”,
字段:{
meetingID:{from:“meetingID”,键入:“number”},
标题:{from:“title”,defaultValue:“No title”,验证:{required:true},
开始:{键入:“日期”,从:“开始”},
结束:{type:“date”,from:“end”},
startTimezone:{from:“startTimezone”},
endTimezone:{from:“endTimezone”},
描述:{from:“description”},
recurrenceId:{from:“recurrenceId”},
复发癌:{来自:“复发癌”},
recurrenceException:{from:“recurrenceException”},
roomId:{from:“roomId”,可为空:true},
与会者:{from:“与会者”,可空:true},
isAllDay:{type:“boolean”,from:“isAllDay”}
}
}
}
},
组:{
资源:[“与会者”],
方向:“垂直”
},
groupHeaderTemplate:$(“#groupHeaderTemplate”).html(),
资源:[
{
字段:“与会者”,
名称:“与会者”,
数据源:[
{文本:“Alex”,值:1,颜色:#f8a398,图像:http://localhost:8080/car-rent app/kendo/examples/content/chat/Doctor2.jpg“},
{文本:“Bob”,值:2,颜色:#51a0ed,图像:http://localhost:8080/car-rent app/kendo/examples/content/chat/Doctor3.jpg“},
{文本:“查理”,值:3,颜色:#56ca85,图像:http://localhost:8080/car-rent app/kendo/examples/content/chat/Doctor4.jpg“}
],
多重:对,
标题:“与会者”
}
],
slotTemplate:“
});
.k-scheduler-timelineWeekview.k-scheduler-table td,
.k-scheduler-timelineview tr:n子级(2).k-scheduler-table td,
.k-scheduler-timelineview tr:n子级(2).k-scheduler-table th,
.k-scheduler-timelineWorkWeekview.k-scheduler-table td,
.k-scheduler-timelineMonthview.k-scheduler-table td{
高度:71px!重要;
}
可能是固定高度71px。为什么不移除它并将顶部与CSS对齐?我必须将高度设置为71px,这就是它具有固定高度的原因。高度没有从86px减少。可能是固定高度71px。为什么不移除它并将顶部与CSS对齐?我必须将高度设置为71px,这就是它具有固定高度的原因。高度不是从86px减少。