From f734ba0d3ab8fbe822b8fe2a04b3422529e367b1 Mon Sep 17 00:00:00 2001 From: Kiran Ashok Date: Thu, 13 Oct 2022 14:25:47 +0530 Subject: [PATCH] [ Feature ] :: Table :: event on discard changes :: (#4158) * discard changes :: event added * develop merge --- frontend/src/Editor/Components/Table/Table.jsx | 5 ++++- frontend/src/Editor/WidgetManager/widgetConfig.js | 1 + frontend/src/_helpers/appUtils.js | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/Editor/Components/Table/Table.jsx b/frontend/src/Editor/Components/Table/Table.jsx index 54a3311774..85767d777c 100644 --- a/frontend/src/Editor/Components/Table/Table.jsx +++ b/frontend/src/Editor/Components/Table/Table.jsx @@ -202,7 +202,10 @@ export function Table({ setExposedVariables({ changeSet: {}, dataUpdates: [], - }).then(() => mergeToTableDetails({ dataUpdates: {}, changeSet: {} })); + }).then(() => { + mergeToTableDetails({ dataUpdates: {}, changeSet: {} }); + fireEvent('onCancelChanges'); + }); } const changeSet = tableDetails?.changeSet ?? {}; diff --git a/frontend/src/Editor/WidgetManager/widgetConfig.js b/frontend/src/Editor/WidgetManager/widgetConfig.js index ed18598bc8..d9c0437568 100644 --- a/frontend/src/Editor/WidgetManager/widgetConfig.js +++ b/frontend/src/Editor/WidgetManager/widgetConfig.js @@ -239,6 +239,7 @@ export const widgets = [ onBulkUpdate: { displayName: 'Bulk update' }, onPageChanged: { displayName: 'Page changed' }, onSearch: { displayName: 'Search' }, + onCancelChanges: { displayName: 'Cancel changes' }, onSort: { displayName: 'On sorting columns' }, onCellValueChanged: { displayName: 'Cell value changed' }, onFilterChanged: { displayName: 'Filter changed' }, diff --git a/frontend/src/_helpers/appUtils.js b/frontend/src/_helpers/appUtils.js index 4ddd7a3746..e0f76ededa 100644 --- a/frontend/src/_helpers/appUtils.js +++ b/frontend/src/_helpers/appUtils.js @@ -512,6 +512,7 @@ export async function onEvent(_ref, eventName, options, mode = 'edit') { 'onOpen', 'onClose', 'onRowClicked', + 'onCancelChanges', 'onSort', 'onCellValueChanged', 'onFilterChanged',