diff --git a/frontend/src/components/ListViews/CallLogsListView.vue b/frontend/src/components/ListViews/CallLogsListView.vue index bf04ccf7..45e8d8b9 100644 --- a/frontend/src/components/ListViews/CallLogsListView.vue +++ b/frontend/src/components/ListViews/CallLogsListView.vue @@ -10,6 +10,7 @@ }" row-key="name" v-bind="$attrs" + ref="listViewRef" > { }) const listBulkActionsRef = ref(null) +const listViewRef = ref(null) +watch( + () => Array.from(listViewRef.value?.selections || []), + (selections) => { + emit('selectionsChanged', selections) + }, +) defineExpose({ customListActions: computed( () => listBulkActionsRef.value?.customListActions, diff --git a/frontend/src/components/ListViews/ContactsListView.vue b/frontend/src/components/ListViews/ContactsListView.vue index aeecb7c8..4d2b314b 100644 --- a/frontend/src/components/ListViews/ContactsListView.vue +++ b/frontend/src/components/ListViews/ContactsListView.vue @@ -14,6 +14,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" + ref="listViewRef" > { }) const listBulkActionsRef = ref(null) +const listViewRef = ref(null) + +watch( + () => Array.from(listViewRef.value?.selections || []), + (selections) => { + emit('selectionsChanged', selections) + }, +) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/DealsListView.vue b/frontend/src/components/ListViews/DealsListView.vue index ddd0df51..6b90e400 100644 --- a/frontend/src/components/ListViews/DealsListView.vue +++ b/frontend/src/components/ListViews/DealsListView.vue @@ -14,6 +14,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" + ref="listViewRef" > { }) const listBulkActionsRef = ref(null) +const listViewRef = ref(null) + +watch( + () => Array.from(listViewRef.value?.selections || []), + (selections) => { + emit('selectionsChanged', selections) + }, +) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/EmailTemplatesListView.vue b/frontend/src/components/ListViews/EmailTemplatesListView.vue index 2d937cb8..df8b1118 100644 --- a/frontend/src/components/ListViews/EmailTemplatesListView.vue +++ b/frontend/src/components/ListViews/EmailTemplatesListView.vue @@ -9,6 +9,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" + ref="listViewRef" > { }) const listBulkActionsRef = ref(null) +const listViewRef = ref(null) + +watch( + () => Array.from(listViewRef.value?.selections || []), + (selections) => { + emit('selectionsChanged', selections) + }, +) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/LeadsListView.vue b/frontend/src/components/ListViews/LeadsListView.vue index dccfe438..09addab8 100644 --- a/frontend/src/components/ListViews/LeadsListView.vue +++ b/frontend/src/components/ListViews/LeadsListView.vue @@ -14,6 +14,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" + ref="listViewRef" > { }) const listBulkActionsRef = ref(null) +const listViewRef = ref(null) + +watch( + () => Array.from(listViewRef.value?.selections || []), + (selections) => { + emit('selectionsChanged', selections) + }, +) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/OrganizationsListView.vue b/frontend/src/components/ListViews/OrganizationsListView.vue index 8dfc0ae6..a8c27900 100644 --- a/frontend/src/components/ListViews/OrganizationsListView.vue +++ b/frontend/src/components/ListViews/OrganizationsListView.vue @@ -13,6 +13,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" + ref="listViewRef" > { }) const listBulkActionsRef = ref(null) +const listViewRef = ref(null) + +watch( + () => Array.from(listViewRef.value?.selections || []), + (selections) => { + emit('selectionsChanged', selections) + }, +) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/TasksListView.vue b/frontend/src/components/ListViews/TasksListView.vue index 7109449f..18d239d9 100644 --- a/frontend/src/components/ListViews/TasksListView.vue +++ b/frontend/src/components/ListViews/TasksListView.vue @@ -9,6 +9,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" + ref="listViewRef" > { }) const listBulkActionsRef = ref(null) +const listViewRef = ref(null) + +watch( + () => Array.from(listViewRef.value?.selections || []), + (selections) => { + emit('selectionsChanged', selections) + }, +) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ViewControls.vue b/frontend/src/components/ViewControls.vue index fdd40323..a4a9b5bf 100644 --- a/frontend/src/components/ViewControls.vue +++ b/frontend/src/components/ViewControls.vue @@ -545,6 +545,11 @@ function reload() { const showExportDialog = ref(false) const export_type = ref('Excel') const export_all = ref(false) +const selectedRows = ref([]) + +function handleSelectionsChange(selections) { + selectedRows.value = selections +} async function exportRows() { let fields = JSON.stringify(list.value.data.columns.map((f) => f.key)) @@ -560,7 +565,15 @@ async function exportRows() { page_length = list.value.data.total_count } - window.location.href = `/api/method/frappe.desk.reportview.export_query?file_format_type=${export_type.value}&title=${props.doctype}&doctype=${props.doctype}&fields=${fields}&filters=${filters}&order_by=${order_by}&page_length=${page_length}&start=0&view=Report&with_comment_count=1` + let url = `/api/method/frappe.desk.reportview.export_query?file_format_type=${export_type.value}&title=${props.doctype}&doctype=${props.doctype}&fields=${fields}&filters=${filters}&order_by=${order_by}&page_length=${page_length}&start=0&view=Report&with_comment_count=1` + + // Add selected items parameter if rows are selected + if (selectedRows.value?.length && !export_all.value) { + url += `&selected_items=${JSON.stringify(selectedRows.value)}` + } + + window.location.href = url + showExportDialog.value = false export_all.value = false export_type.value = 'Excel' @@ -1336,6 +1349,7 @@ defineExpose({ viewActions, viewsDropdownOptions, currentView, + handleSelectionsChange, }) // Watchers diff --git a/frontend/src/pages/CallLogs.vue b/frontend/src/pages/CallLogs.vue index 29ea5f01..f3bc54a2 100644 --- a/frontend/src/pages/CallLogs.vue +++ b/frontend/src/pages/CallLogs.vue @@ -41,6 +41,9 @@ @applyFilter="(data) => viewControls.applyFilter(data)" @applyLikeFilter="(data) => viewControls.applyLikeFilter(data)" @likeDoc="(data) => viewControls.likeDoc(data)" + @selectionsChanged=" + (selections) => viewControls.handleSelectionsChange(selections) + " />