【问题标题】:DHTMLX Scheduler custom Timeline with AM/PM daysDHTMLX 调度程序自定义时间线与 AM/PM 天
【发布时间】:2020-03-23 20:06:00
【问题描述】:

我在一个项目的时间线视图中使用 DHTMLX 调度程序,工作时间是从早上 7 点到下午 5 点。我能够每天制作一个 AM/PM 视图,但视图中不考虑 first_hour 和 last_hour 配置。屏幕截图显示更多。早上的第一个事件应该显示在更左边,因为它从早上 7:30 开始。

我的配置:

scheduler.locale.labels.timeline_tab = "Timeline";
scheduler.locale.labels.section_custom = "Section";

scheduler.config.dblclick_create = false;
scheduler.config.edit_on_create = false;
scheduler.config.details_on_dblclick = false;
scheduler.config.details_on_create = false;
scheduler.config.start_on_monday = true;
scheduler.config.first_hour = 7;
scheduler.config.last_hour = 17;
scheduler.config.full_day = true;
scheduler.config.mark_now = false;

scheduler.config.drag_move = false;
scheduler.config.drag_resize = false;

//===============
//Configuration
//===============

scheduler.createTimelineView({
    name: "timeline",
    x_unit: "hour",
    x_date: "%A",
    x_step: 12,
    x_size: 14,
    x_start: 0,
    x_length: 14,
    y_unit: scheduler.serverList('teams'), // sections and events from same ajax call
    y_property: "team_id",
    render: "bar",
    section_autoheight: false,
    dy: 30,
    dx: 100,
    // first_hour: 7,
    // last_hour: 17,
    second_scale: {
        x_unit: "day", // unit which should be used for second scale
        x_date: "%D %j %M"
    }
});

我们将不胜感激。

编辑: 根据此处的答案进行更新后,结果:

【问题讨论】:

    标签: dhtmlx dhtmlx-scheduler


    【解决方案1】:

    first_hourlast_hour 配置应用于日、周、单位视图中的 Y 轴(检查 Documentation)。

    目前,要在时间轴视图中隐藏一天的开始和结束时间,您应该只有 1 个 X 轴,例如 sample。 IE。由于createTimelineView 方法的first_hourend_hour 属性,事件的可见部分是从10 到18。检查screenshot

    还有 ignore_[viewName] function 可用于隐藏等于刻度最小步长的间隔(在您的情况下为 12 小时)。

    如果设置 min step = 6(小时)并通过 addMarkedTimespan 禁用早上 6-7 点和下午 5-6 点,这可能有助于解决您的问题。我尝试为您创建一个 sn-p http://snippet.dhtmlx.com/46ba545ad ,但发现此条件的第二部分 if(date.getHours() < 6 || date.getHours() > 17){ 无法正常工作。该事件可以创建到下午 6 点。我们会尽快修复它,但现在我无法指定确切的时间。我建议你使用第一种方式来解决这个问题。

    【讨论】:

    • 这对我帮助很大。确实条件 17 无法正常工作。
    猜你喜欢
    • 2015-02-20
    • 2020-03-29
    • 1970-01-01
    • 1970-01-01
    • 2020-03-27
    • 2022-01-19
    • 1970-01-01
    • 2020-03-26
    • 2019-10-24
    相关资源
    最近更新 更多