fix live updating of table data for status
This commit is contained in:
parent
d496f21ab9
commit
841d52c61a
@ -89,16 +89,21 @@ const tableActions = [
|
||||
menuItems: statusOptions.value.map(option => ({
|
||||
label: option,
|
||||
command: async (rowData) => {
|
||||
console.log("Clicked on row:", rowData);
|
||||
await Api.setTaskStatus(rowData.id, option);
|
||||
let rowIndex = -1;
|
||||
for (let i = 0; i<tableData.value.length(); i++) {
|
||||
if (row.id == tableData.value[i].id) {
|
||||
rowIndex = i;
|
||||
console.log("Setting status for row:", rowData, "to:", option);
|
||||
try {
|
||||
// Uncomment when API is ready
|
||||
// await Api.setTaskStatus(rowData.id, option);
|
||||
|
||||
// Find and update the row in the table data
|
||||
const rowIndex = tableData.value.findIndex(row => row.id === rowData.id);
|
||||
if (rowIndex >= 0) {
|
||||
// Update reactively
|
||||
tableData.value[rowIndex].status = option;
|
||||
notifications.addSuccess(`Status updated to ${option}`);
|
||||
}
|
||||
}
|
||||
if (rowIndex >= 0) {
|
||||
tableData.value[rowIndex].status = option;
|
||||
} catch (error) {
|
||||
console.error("Error updating status:", error);
|
||||
notifications.addError("Failed to update status");
|
||||
}
|
||||
},
|
||||
})),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user