网格中行高调整
可以修改网格中各个行的高度。
dhtmlxGantt 库提供两种方式来管理行高:
- 为需要的任务对象同时设置行高和任务条的高度;
- 通过拖动网格行的底部边框。
注释
本功能在 v7.1 及以上版本可用。
设置行高
您可以根据需要调整某一行的高度。
注释
单独的行高目前与 static background rendering 不兼容。

为此,您需要在数据集中重新定义任务对象的 row_height 和 bar_height 属性:
在数据集中指定任务的类型
gantt.parse({
data: [
{ id: 11, text: "Project #1", type: "project", progress: 0.6, open: true,
row_height: 70, bar_height: 60 }, /*!*/
{ id: 12, text: "Task #1", start_date: "03-04-2018", duration: "5",
parent: "11", progress: 1, open: true },
{ id: 13, text: "Task #2", start_date: "03-04-2018", type: "project",
parent: "11", progress: 0.5, open: true }
],
links: []
});
或您也可以动态实现:
gantt.getTask(11).row_height = 50;
gantt.getTask(11).bar_height = 25;
// 重新渲染 Gantt 以应用更改
gantt.render();
如果任务对象的 row_height 和 bar_height 属性未指定或为空(默认状态),将使用 gantt.config.row_height 和 gantt.config.bar_height 的值。