Comments (6)
Please use v0.3.0 version. This issue has been fixed
@synapse @psybor
from react-gantt.
Please provide the minimum recurrence demo
It's simple, just as @synapse said, I store data
in the AppComponent. When onUpdate
, I setData
.
Then, every change triggers a whole update.
import dayjs from 'dayjs'
import RcGantt from 'rc-gantt'
import React, { useState } from 'react'
interface Data {
name: string
startDate: string
endDate: string
id: number
}
const _data = Array.from({ length: 100 })
.fill({
name: '一个名称一个名称一个名称一个名称',
startDate: dayjs().format('YYYY-MM-DD'),
endDate: dayjs().add(1, 'week').format('YYYY-MM-DD'),
})
.map((d: any, idx) => ({
...d,
id: idx,
})) as Data[]
const App = () => {
const [data, setData] = useState(_data)
return (
<div style={{ width: '100%', height: 500 }}>
<RcGantt<Data>
lang='zh-CN'
data={data}
columns={[
{
name: 'name',
label: '名称',
width: 100,
},
]}
onUpdate={async (row, startDate, endDate) => {
console.log('update', row, startDate, endDate)
setData(prev => {
const newList = [...prev]
const index = newList.findIndex(val => val.id === row.id)
newList[index] = {
...row,
startDate: dayjs(startDate).format('YYYY-MM-DD'),
endDate: dayjs(endDate).format('YYYY-MM-DD'),
}
return newList
})
return true
}}
/>
</div>
)
}
export default App
from react-gantt.
Can you provide a moving image demonstration?
from react-gantt.
Sure thing @ahwgs, here it is (also had to disable toggling the open/close of the sidebar since it would constantly close it).
gantt.mov
from react-gantt.
Please provide the minimum recurrence demo
from react-gantt.
@ahwgs It should be simple to replicate it yourself in your dev-env. All your example use a const array as the source of the data and non of the Gantt components update it. In my case the Gantt data is stored in the component's state and on onUpdate
I'm just updating the correct gantt row.
Another way to do it would be just to trigger a component refresh onUpdate
- should have that same effect
from react-gantt.
Related Issues (20)
- Support Multi-language HOT 1
- 左侧table自动化时自动收起 HOT 3
- 列宽、table、日历宽度支持拖拽调整
- dependencies的数据之间的连线颜色自定义 HOT 1
- 左侧table部分可隐藏 HOT 1
- 左侧hideTable设置true后,还是保留了空间
- 能否在进度条中增加进度比例 HOT 1
- 左侧隐藏table后再点击显示,样式错乱 HOT 1
- 是否能允许自定义“小时图”“半小时图”“分钟图” HOT 1
- 是否可以支持单条禁用
- Bug:点击隐藏左侧表格后,再点击展开,左侧表格内容显示会出现问题
- 能否让左侧实现滑动条滚动
- 切换年、季视图时,会修改时间周期 HOT 2
- 能否让左侧某一列可以横向滚得,例如第一列 HOT 3
- 在数据里设置disabled为true,甘特图仍然能够拖动 HOT 1
- 能否支持单条数据多个时间进度条 HOT 1
- 需要支持左右滑动最大最小时间区间
- It's an amazing library. Just wanted to know if there is a way to translate the language to English for all the elements. HOT 3
- 【Feature】支持自定义 sightConfig 配置 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-gantt.