css 资源FullCalendar中的固定列宽

iq0todco  于 2023-03-05  发布在  其他
关注(0)|答案(5)|浏览(345)

我使用的是支持资源视图的FullCalendar特殊版本。http://tux.fi/~jarnok/fullcalendar-resourceviews/
我只有几个问题,它似乎会自动设置列宽,我认为应用这种方法可以解决以下问题:

.fc-widget-header
{
    width:100px;
}
.fc-widget-content
{
    width:100px;
}
.fc-resourceName
{
    background-color:aliceblue;
    width:150px;
}

然后html写单元格的宽度是100px,但它仍然试图自动适应一切。
我想要它做的是,如果它太大,水平滚动,但我总是希望每个单元格是确切的100px。
我有这种风格的滚动:

#calendar
{
    overflow-x:auto;
}

但是元素仍然显示为基于日期的可变宽度,如下所示:

很明显,我的每一列都不是我所要求的100px,资源列也不是我所要求的150px。我该怎么做才能得到想要的外观呢?
另一个问题是没有为新的一周定义类。我真的很想显示第X周用不同颜色写的列。
对这两个问题的任何见解都将非常有帮助。
谢谢

lc8prwob

lc8prwob1#

对于在垂直资源视图中搜索解决方案的任何人,这对我很有帮助:

.fc table{
    table-layout: auto;
}
.fc-view > table{  
    min-width: 0;
    width: auto;
}
.fc-axis{
    min-width:100px; /*the width of times column*/
    width:100px; /*the width of times column*/
}
.fc-day,.fc-resource-cell,.fc-content-col{
    min-width:300px;
    width:300px;
}
nhaq1z21

nhaq1z212#

我想我以前也有过这样的问题,把这条线放在我的日历表上对我很有效。
#calendar table { table-layout: fixed; }

a2mppw5e

a2mppw5e3#

我知道我的解决方案是不相关的,但是感谢“overflow-x:auto;“这帮助我解决了我的问题。
这适用于我在agendaView中使用垂直视图like this中的列资源的原始fullCalendar + Scheduler:

@media (min-width: 1170px) {
    div.fc-view.fc-agendaDay-view.fc-agenda-view table {
        max-width: 100%;
    }
}
@media (max-width: 1170px) {
    div.fc-view-container {
        overflow-x: scroll;
    }
    div.fc-view.fc-agendaDay-view.fc-agenda-view table {
        min-width: 1170px;
    }
}

这种方式是使用原来的最小宽度设置为120 px的列,是响应,但使用滚动的额外大小,使它看起来更好的小型设备。

p5fdfcr1

p5fdfcr14#

$('#calendar').fullCalendar({
 contentHeight: 'auto',
                aspectRation: 1.35,
})

这可以解决您的问题

sg2wtvxw

sg2wtvxw5#

如果有人在使用较新版本的fullcalendar时遇到这种情况,可以使用v4中的slotWidth设置和v5/6中的slotMinWidth设置。
如果您想覆盖每个视图的slotMinWidth,您可以在views属性中执行此操作。在以下示例中,所有视图将共享相同的slotMinWidth,但resourceTimelineDay(标准包含视图)除外,它具有覆盖。

slotMinWidth: 100,
views: {
   resourceTimelineDay: {
     slowMinWidth: 50
   }
}

相关问题