gantt
gantt copied to clipboard
[BUG] I create startDate and endDate in rowtable, but when i change data in table, data not update, therefor data in gantt is old data
[BUG] I create startDate and endDate in rowtable, but when i change data in table, data not update, therefor data in gantt is old data
paste your minimum reproduction code
I change data in collumn and refetch data, but new data not update, so row in <template #default="{ row }"> is old data
`<XGanttColumn prop="timeline" :merge="merge5" width="100">
<template #title="data">
<div>
title timeline
</div>
</template>
<template #default="{ row }">
<div v-show="!row.phaseId">
<!-- timeline={{ fromDate: detailProject?.fromDate, toDate: detailProject?.toDate }} -->
<FieldRangeDate
:placeholder="['DD/MM/YYYY', 'DD/MM/YYYY']"
:value="{ fromDate: row?.startDate, toDate: handleEndDate(row?.endDateAdd) }"
:onSubmit="(value) => handleUpdateFieldValue(row._id, 'timeline', value)"
/>
</div>
</template>
</XGanttColumn>`
I change data in collumn and refetch data, but new data not update, so row in <template #default="{ row }"> is old data `<XGanttColumn prop="timeline" :merge="merge5" width="100"> <template #title="data"> <div> title timeline </div> </template> <template #default="{ row }"> <div v-show="!row.phaseId"> <!-- timeline={{ fromDate: detailProject?.fromDate, toDate: detailProject?.toDate }} --> <FieldRangeDate :placeholder="['DD/MM/YYYY', 'DD/MM/YYYY']" :value="{ fromDate: row?.startDate, toDate: handleEndDate(row?.endDateAdd) }" :onSubmit="(value) => handleUpdateFieldValue(row._id, 'timeline', value)" /> </div> </template> </XGanttColumn>`
reload data
yes reload data, but it not work. I realize this code in useInView, i think problem, but i don't know how to fix
watch( () => [top.value, bottom.value, store.$data.flatData], () => { for (let i = inView.length - 1; i >= 0; i--) { if ( inView[i].hide || inView[i].flatIndex <= top.value || inView[i].flatIndex >= bottom.value || store.$data.flatData[inView[i].flatIndex].id !== inView[i].id ) { inView.splice(i, 1); } } for (let i = top.value; i < bottom.value; i++) { if (!~inView.findIndex((v) => v.flatIndex === i)) { const oldIndex = inView.findIndex((v) => v.flatIndex === store.$data.flatData[i].flatIndex); if (~oldIndex) { inView.splice(oldIndex, 1, store.$data.flatData[i]); } else { inView.push(store.$data.flatData[i]); } } } }, );
if i try this code, reRender all, The screen will flicker,
`watch(
() => [top.value, bottom.value, store.$data.flatData],
() => {
for (let i = inView.length - 1; i >= 0; i--) {
if (
inView[i].hide ||
inView[i].flatIndex <= top.value ||
inView[i].flatIndex >= bottom.value ||
store.$data.flatData[inView[i].flatIndex].id !== inView[i].id
) {
inView.splice(i, 1);
}
}
for (let i = top.value; i < bottom.value; i++) {
const dataIndex = store.$data.flatData[i].flatIndex;
const existingIndex = inView.findIndex((v) => v.flatIndex === dataIndex);
if (existingIndex !== -1) {
inView.splice(existingIndex, 1, store.$data.flatData[i]);
} else {
inView.push(store.$data.flatData[i]);
}
}
},
);`
yes reload data, but it not work. I realize this code in useInView, i think problem, but i don't know how to fix
watch( () => [top.value, bottom.value, store.$data.flatData], () => { for (let i = inView.length - 1; i >= 0; i--) { if ( inView[i].hide || inView[i].flatIndex <= top.value || inView[i].flatIndex >= bottom.value || store.$data.flatData[inView[i].flatIndex].id !== inView[i].id ) { inView.splice(i, 1); } } for (let i = top.value; i < bottom.value; i++) { if (!~inView.findIndex((v) => v.flatIndex === i)) { const oldIndex = inView.findIndex((v) => v.flatIndex === store.$data.flatData[i].flatIndex); if (~oldIndex) { inView.splice(oldIndex, 1, store.$data.flatData[i]); } else { inView.push(store.$data.flatData[i]); } } } }, );
if i try this code, reRender all, The screen will flicker, `watch( () => [top.value, bottom.value, store.$data.flatData], () => { for (let i = inView.length - 1; i >= 0; i--) { if ( inView[i].hide || inView[i].flatIndex <= top.value || inView[i].flatIndex >= bottom.value || store.$data.flatData[inView[i].flatIndex].id !== inView[i].id ) { inView.splice(i, 1); } } for (let i = top.value; i < bottom.value; i++) { const dataIndex = store.$data.flatData[i].flatIndex; const existingIndex = inView.findIndex((v) => v.flatIndex === dataIndex); if (existingIndex !== -1) { inView.splice(existingIndex, 1, store.$data.flatData[i]); } else { inView.push(store.$data.flatData[i]); } } }, );`
This code no problem in my env and who uses it. If you have some minimum reproduction code, I can test it.