以下是 "新版功能",如果您需要了解更多信息,您可以联系我们。
2020年6月19日错误修复发布
duration_unit
config设置为“小时”时,工作时间计算的性能改进。duration_unit
config设置为“分钟”时,工作时间计算的性能改进。Gantt.getGanttInstance
功能已添加。2020年6月4日错误修复发布
gantt.columnIndexByDate
的返回类型。
end_date/duration
when duration_unit
is set to "minute" and the last worktime interval finishes after 23:00grouping extension
to expand whenever the user modified any taskdataProcessor.setTransactionMode
to be ignored if an object was passed into the first parameterinline editor
to disappear after repaint of Gantt
static_background
extension which caused mouse click on empty cells to be interpreted as a click on task elementssplit tasks
during drag and dropnode.js
packagenode.js
package功能
配置
API
dhtmlxGantt 提供两种可选的内容编辑方式:
内联编辑允许您直接通过网格进行任何更改: 创建和更新任务, 设置它们之间的连接, 定义开始和结束日期, 或者通过内置编辑器修改持续时间。
为启用行内编辑,你需要
var textEditor = {type: "text", map_to: "text"};
var dateEditor = {type: "date", map_to: "start_date", min: new Date(2018, 0, 1),
max: new Date(2019, 0, 1)};
var durationEditor = {type: "number", map_to: "duration", min:0, max: 100};
gantt.config.columns = [
{name: "text", tree: true, width: '*', resize: true, editor: textEditor},
{name: "start_date", align: "center", resize: true, editor: dateEditor},
{name: "duration", align: "center", editor: durationEditor},
{name: "add", width: 44}
];
在列类型配置对象中保存行内编辑器,目前支持下面几种编辑器:
text editor
- for editing text columns, e.g. task namenumber editor
- for editing number columns, e.g. task duration, order, etc.date editor
- for editing date columns, e.g. start and end dates of the taskselect editor
- for choosing an option from a listpredecessor editor
- for setting task-predecessor for the currently edited task. This editor gets the WBS codes of tasks to set connection with the predecessor task.var editors = {
text: {type: "text", map_to: "text"},
start_date: {type: "date", map_to: "start_date", min: new Date(2018, 0, 1),
max: new Date(2019, 0, 1)},
end_date: {type: "date", map_to: "end_date", min: new Date(2018, 0, 1),
max: new Date(2019, 0, 1)},
duration: {type: "number", map_to: "duration", min:0, max: 100},
priority: {type:"select", map_to:"priority", options:gantt.serverList("priority")},
predecessors: {type: "predecessor", map_to: "auto"}
};
下面是例子代码:
gantt.config.editor_types.custom_editor = {
show: function (id, column, config, placeholder) {
// called when input is displayed, put html markup of the editor into placeholder
// and initialize your editor if needed:
var html = "";
placeholder.innerHTML = html;
},
hide: function () {
// called when input is hidden
// destroy any complex editors or detach event listeners from here
},
set_value: function (value, id, column, node) {
// set input value
},
get_value: function (id, column, node) {
// return input value
},
is_changed: function (value, id, column, node) {
// called before save/close. Return true if new value differs from the original one
// returning true will trigger saving changes, returning false will skip saving
},
is_valid: function (value, id, column, node) {
// validate, changes will be discarded if the method returns false
return true/false;
},
save: function (id, column, node) {
// only for inputs with map_to:auto. complex save behavior goes here
},
focus: function (node) {
}
}