如以下Dhtmlx源码所示
该文件位置:node_modules\dhtmlx-gantt\codebase\dhtmlxgantt.js
labels: {
new_task: "新任務",
icon_save: "保存",
icon_cancel: "关闭",
icon_details: "详细",
icon_edit: "编辑",
icon_delete: "删除",
confirm_closing: "请确认是否撤销修改!",
confirm_deleting: "是否删除日程?",
section_description: "标题",
section_time: "日期选择",
section_type: "负责人",
column_wbs: "工作分解结构",
column_text: "任务名",
column_start_date: "开始时间",
column_duration: "持续时间",
column_add: "",
link: "关联",
confirm_link_deleting: "将被删除",
link_start: " (开始)",
link_end: " (结束)",
type_task: "任务",
type_project: "项目",
type_milestone: "里程碑",
.....
}
这是Dhtmlx gantt中对于linghtbox中name特定值的配置。结合源码可以发现,以下一串代码用于显示表单的表头文字。
t._render_sections = function (t) {
for (var e = "", n = 0; n < t.length; n++) {
var i = this.form_blocks[t[n].type];
if (i) {
t[n].id = "area_" + this.uid();
var r = t[n].hidden ? " style='display:none'" : "",
a = "";
t[n].button && (a = "<div class='gantt_custom_button' data-index='" + n + "'> ·<div class='gantt_custom_button_" + t[n].button + "'></div><div class='gantt_custom_button_label'>" + this.locale.labels["button_" + t[n].button] + "</div>
</div>"), this.config.wide_form && (e += "<div class='gantt_wrap_section' " + r + ">"),
e += "<div id='" + t[n].id + "' class='gantt_cal_lsection'><label>" + a +
this.locale.labels["section_" + t[n].name] + "</label></div>" + i.render.call(this, t[n]), e += "</div>"
console.log('this.locale.labels',this.locale.labels,t[n].name)
}
}
return e
}
代码结构可能比较乱,大致意思就是在此处生成的表单。
"<div id='" + t[n].id + "' class='gantt_cal_lsection'><label>" + a + this.locale.labels["section_" + t[n].name] + "</label></div>"
结合以上这句可发现这里调用的就是最上方的配置文件,再结合传入的name值,进行显示。
所以,我们只需要在上放的配置文件中给它添加一个属性值,让其可以拿到这个数据即可。
如下图所示.
这样设置后,name值即可正常显示