|
|
@ -198,7 +198,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState( |
|
|
|
// 2. delete option from grid view, then switch to kanban view
|
|
|
|
// 2. delete option from grid view, then switch to kanban view
|
|
|
|
// for the second case, formattedData.value and countByStack.value would be empty at this moment
|
|
|
|
// for the second case, formattedData.value and countByStack.value would be empty at this moment
|
|
|
|
// however, the data will be correct after rendering
|
|
|
|
// however, the data will be correct after rendering
|
|
|
|
if (formattedData.value.size && countByStack.value.size && col.title! in formattedData.value) { |
|
|
|
if (formattedData.value.size && countByStack.value.size && formattedData.value.has(col.title!)) { |
|
|
|
// for the first case, no reload is executed.
|
|
|
|
// for the first case, no reload is executed.
|
|
|
|
// hence, we set groupingField to null for all records under the target stack
|
|
|
|
// hence, we set groupingField to null for all records under the target stack
|
|
|
|
await bulkUpdateGroupingFieldValue(col.title!, true) |
|
|
|
await bulkUpdateGroupingFieldValue(col.title!, true) |
|
|
@ -344,7 +344,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState( |
|
|
|
where: `(${groupingField.value},eq,${stackTitle})`, |
|
|
|
where: `(${groupingField.value},eq,${stackTitle})`, |
|
|
|
}, |
|
|
|
}, |
|
|
|
) |
|
|
|
) |
|
|
|
if (stackTitle in formattedData.value) { |
|
|
|
if (formattedData.value.has(stackTitle)) { |
|
|
|
// update to groupingField value to target value
|
|
|
|
// update to groupingField value to target value
|
|
|
|
formattedData.value.set( |
|
|
|
formattedData.value.set( |
|
|
|
stackTitle, |
|
|
|
stackTitle, |
|
|
@ -428,20 +428,26 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState( |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// update existing record
|
|
|
|
// update existing record
|
|
|
|
const targetPrimaryKey = extractPkFromRow(row.row, meta!.value!.columns as ColumnType[]) |
|
|
|
const targetPrimaryKey = extractPkFromRow(row.row, meta!.value!.columns as ColumnType[]) |
|
|
|
const idxToUpdate = formattedData.value |
|
|
|
const idxToUpdateOrDelete = formattedData.value |
|
|
|
.get(stackTitle)! |
|
|
|
.get(oldStackTitle)! |
|
|
|
.findIndex((ele) => extractPkFromRow(ele.row, meta!.value!.columns as ColumnType[]) === targetPrimaryKey) |
|
|
|
.findIndex((ele) => extractPkFromRow(ele.row, meta!.value!.columns as ColumnType[]) === targetPrimaryKey) |
|
|
|
if (idxToUpdate !== -1) { |
|
|
|
if (idxToUpdateOrDelete !== -1) { |
|
|
|
// update the row in formattedData
|
|
|
|
|
|
|
|
formattedData.value.get(stackTitle)![idxToUpdate] = row |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (stackTitle !== oldStackTitle) { |
|
|
|
if (stackTitle !== oldStackTitle) { |
|
|
|
// remove old row from countByStack & formattedData
|
|
|
|
// remove old row from countByStack & formattedData
|
|
|
|
countByStack.value.set(oldStackTitle, countByStack.value.get(oldStackTitle)! - 1) |
|
|
|
countByStack.value.set(oldStackTitle, countByStack.value.get(oldStackTitle)! - 1) |
|
|
|
formattedData.value.get(oldStackTitle)!.pop() |
|
|
|
const updatedRow = formattedData.value.get(oldStackTitle)! |
|
|
|
|
|
|
|
updatedRow.splice(idxToUpdateOrDelete, 1) |
|
|
|
|
|
|
|
formattedData.value.set(oldStackTitle, updatedRow) |
|
|
|
|
|
|
|
|
|
|
|
// add new row to countByStack & formattedData
|
|
|
|
// add new row to countByStack & formattedData
|
|
|
|
countByStack.value.set(stackTitle, countByStack.value.get(stackTitle)! + 1) |
|
|
|
countByStack.value.set(stackTitle, countByStack.value.get(stackTitle)! + 1) |
|
|
|
formattedData.value.get(stackTitle)!.push(row) |
|
|
|
formattedData.value.set(stackTitle, [...formattedData.value.get(stackTitle)!, row]) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// update the row in formattedData
|
|
|
|
|
|
|
|
const updatedRow = formattedData.value.get(stackTitle)! |
|
|
|
|
|
|
|
updatedRow[idxToUpdateOrDelete] = row |
|
|
|
|
|
|
|
formattedData.value.set(oldStackTitle, updatedRow) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|