xpyjs / gantt

An easy-to-use Gantt component. 持续更新,中文文档
https://docs.xiaopangying.com/gantt/
MIT License
243 stars 41 forks source link

分割线拖拽的事件 #114

Closed huoqingzhu closed 2 months ago

huoqingzhu commented 2 months ago

需求是想 拖拽分割线 表格的列宽动态变宽 现在只是最后一列变宽了 希望 中间分割线 拖拽 能暴露出事件来 让我动态的设置XGanttColumn组件的width 属性

xpyjs commented 2 months ago

动态所有列变宽,会导致所有cell重新计算,有性能影响。作为取舍,这个需求目前不做。

如果你有这个需求,可以自行实现。监听最后一列宽度变化,然后动态给每一列的 width 重新赋值。但是最好不要有过多列

huoqingzhu commented 2 months ago

谢谢

huoqingzhu commented 2 months ago

如何监听最后一列变化

jeremyjone commented 2 months ago
const line = document.querySelector(".xg-mid-separate-line")

console.log(line.offsetLeft)

根据你的页面,获取到中线,然后observer这条线的offsetLeft 属性就可以

huoqingzhu commented 2 months ago

好的谢谢 我现在也是这样做的