dxScheduler 时间线视图以当前时间指示器为中心

dxScheduler timeline view centered at current time indicator

我浏览了 devExtreme 文档和示例,但找不到解决方案...

在 Razor 视图中,我按如下方式加载 dxScheduler(它绑定到定义了 "orders" 和 "resources" 的数据库对象):

<div id="scheduler"></div>

<script>
    $(function () {
            $("#scheduler").dxScheduler({
                dataSource: orders,
                views: ["timelineDay"],
                currentView: "timelineDay",
                showCurrentTimeIndicator: true,
                shadeUntilCurrentTime: true,
                firstDayOfWeek: 0,
                startDayHour: 0,
                endDayHour: 24,
                cellDuration: 15,
                groups: ["areaId"],
                resources: [{
                    fieldExpr: "areaId",
                    allowMultiple: false,
                    dataSource: resources,
                    label: ""
                }],
                height: "100%"
            })
        });
</script>

它工作正常。但是,在保持 cellDuration = 15 分钟的同时:

如有任何建议,我们将不胜感激。谢谢

原来我只看"Configuration"部分。但是也有"Methods"... 答案是使用"scrollToTime"方法。

参考: https://js.devexpress.com/Documentation/ApiReference/UI_Widgets/dxScheduler/Methods/#scrollToTimehours_minutes_date.

更新了工作示例(然后直接设置 "scrollToTime" 动态的参数)。

$(function () {
    $("#scheduler").dxScheduler({
        dataSource: orders,
        views: ["timelineDay"],
        currentView: "timelineDay",
        showCurrentTimeIndicator: true,
        shadeUntilCurrentTime: true,
        firstDayOfWeek: 0,
        startDayHour: 0,
        endDayHour: 24,
        cellDuration: 15,
        groups: ["areaId"],
        resources: [{
            fieldExpr: "areaId",
            allowMultiple: false,
            dataSource: resources,
            label: ""
        }],
        height: "100%",
        onContentReady: function (e) {
            e.component.scrollToTime(5, 30, new Date());
        }
    })
});