如何在dhtmlxgantt中显示灯箱中的开始日期、结束日期和持续时间

how can i display the start date, the end date and the duration from the lightbox in dhtmlx gantt?

本文关键字:日期 开始 结束 持续时间 dhtmlxgantt 显示      更新时间:2023-09-26

在我的web应用程序J2EE中,我使用dhtmlx来显示甘特图,我显示了灯箱的描述值

alert(gantt.getLightboxSection("description").getValue())

我不知道如何显示其他字段,我用了

alert(gantt.getLightboxSection("time").getValue());

但我有[对象对象]。如何在灯箱中显示开始日期、结束日期和持续时间?这里是灯箱的图片

时间控件被映射到多个属性,因此它返回一个具有以下结构的对象

{
  start_date: Date,
  end_date: Date,
  duration: Number
}

如果你想在警报中查看它,你需要将对象字符串化为JSON:

alert(JSON.stringify(gantt.getLightboxSection("time").getValue()));

样品http://docs.dhtmlx.com/gantt/snippet/ed9eab5c

如果您需要格式化的输出,您可以访问对象值-http://docs.dhtmlx.com/gantt/snippet/ff33992d