我有一些自定义的日期,月份等。在dhtmlx甘特图中的行。我想为每行设置固定的高度。我的意思是如果我也添加或删除行,高度不应该依赖于父height.It应该是constant.For示例-如果我也添加10行,每个单独行的高度应该是恒定的,但它保持减小以适合父高度。下面是代码
HTML/JAVASCRIPT
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' type='text/css' href='http://cdn.dhtmlx.com/gantt/edge/dhtmlxgantt.css'>
<script src='http://cdn.dhtmlx.com/gantt/edge/dhtmlxgantt.js'></script>
<style>
.gantt_custom_button {
background-color: rgb(206, 206, 206);
position: absolute;
right: -10px;
top: 5px;
width: 20px;
height: 26px;
border-radius: 0;
}
</style>
</head>
<div id='gantt_here' style='width:100%; height:500px;'></div>
<body>
<script>
var task1 = {
'data': [{
'id': 1,
'text': 'Project #1',
'start_date': '01-04-2019',
'duration': 2,
'order': 10,
'progress': 0.4,
'open': true
},
{
'id': 2,
'text': 'Task #1',
'start_date': '02-04-2019',
'duration': 1,
'order': 10,
'progress': 0.6,
'parent': 1
},
{
'id': 3,
'text': 'Task #2',
'start_date': '03-04-2019',
'duration': 2,
'order': 20,
'progress': 0.6,
'parent': 1
},
{
'id': 4,
'text': 'Task #3',
'start_date': '05-04-2019',
'duration': 1,
'order': 10,
'progress': 0.6,
'parent': 1
}
],
'links': [{
'id': 1,
'source': 1,
'target': 2,
'type': '1'
},
{
'id': 2,
'source': 2,
'target': 3,
'type': '0'
},
{
'id': 3,
'source': 3,
'target': 4,
'type': '0'
},
{
'id': 4,
'source': 2,
'target': 5,
'type': '2'
}
]
};
gantt.config['scales'] = [{
unit: 'day',
step: 1,
format: '%d %M'
},
{unit: "year", step: 1, format: "%Y"},
{unit: "month", step: 1, format: "%M"},
{unit: "month", step: 1, format: "%M"},
{unit: "month", step: 1, format: "%M"}
//{unit: "month", step: 3, format: monthScaleTemplate},
];
gantt.config.scale_height = 100;
gantt.init('gantt_here');
gantt.parse(task1);
</script>
</html>
发布于 2020-12-28 22:29:03
通常,无论图表中有多少任务,任务行高度都不会发生变化。并且有动态改变高度的内置功能。
您可以在代码片段中看到它是如何工作的:
http://snippet.dhtmlx.com/5/664877d50
如果这对您没有帮助,请在上面的代码片段中添加您的配置,并确保问题在那里重现。然后,单击Share
按钮并将链接发送给我。或者给我一个所有必要的Javascript和CSS文件的现成演示,这样我就可以在本地重现这个问题。
https://stackoverflow.com/questions/65459480
复制相似问题