From 0fd676adacc300b0de548d515ce05962c84ce412 Mon Sep 17 00:00:00 2001 From: Dede Fuji Abdul Date: Fri, 29 Mar 2024 12:38:37 +0700 Subject: [PATCH] Refactor onCellClicked function to handle expanded and collapsed rows --- .../Pages/Gangguan/Rekap/RGangguan_ALL.vue | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue b/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue index 9fd6480..e69a693 100755 --- a/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue +++ b/src/components/Pages/Gangguan/Rekap/RGangguan_ALL.vue @@ -1113,7 +1113,7 @@ const reportMeta = ref({ }) const onCellClicked = (e: any) => { - // console.log('cell clicked', e) + console.log('cell clicked', e) // console.log('group cell clicked', e.column.caption) // console.log('value', e.values[e.row.groupIndex]) if (e.rowType == 'group') { @@ -1123,17 +1123,29 @@ const onCellClicked = (e: any) => { if (e.row.groupIndex == 0) { // } else if (e.row.groupIndex == 1) { - const data = e.data.collapsedItems[0].items[0].items[0] - groupData.value = data - console.table(data) + if (e.row.isExpanded) { + const data = e.data.items[0].collapsedItems[0].items[0] + groupData.value = data + } else { + const data = e.data.collapsedItems[0].items[0].items[0] + groupData.value = data + } } else if (e.row.groupIndex == 2) { - const data = e.data.collapsedItems[0].items[0] - groupData.value = data - console.table(data) + if (e.row.isExpanded) { + const data = e.data.items[0].collapsedItems[0] + groupData.value = data + } else { + const data = e.data.collapsedItems[0].items[0] + groupData.value = data + } } else if (e.row.groupIndex == 3) { - const data = e.data.collapsedItems[0] - groupData.value = data - console.table(data) + if (e.row.isExpanded) { + const data = e.data.items[0] + groupData.value = data + } else { + const data = e.data.collapsedItems[0] + groupData.value = data + } } showDetail() } else {