diff --git a/app/client/src/components/designSystems/appsmith/TableActionIcon.tsx b/app/client/src/components/designSystems/appsmith/TableActionIcon.tsx
new file mode 100644
index 0000000000..f464932385
--- /dev/null
+++ b/app/client/src/components/designSystems/appsmith/TableActionIcon.tsx
@@ -0,0 +1,49 @@
+import React from "react";
+import { Tooltip } from "@blueprintjs/core";
+import { IconWrapper } from "constants/IconConstants";
+import { Colors } from "constants/Colors";
+import { TableIconWrapper } from "components/designSystems/appsmith/TableStyledWrappers";
+
+interface TableActionIconProps {
+ tooltip: string;
+ selected: boolean;
+ selectMenu: (selected: boolean) => void;
+ className: string;
+ children: React.ReactNode;
+ icon?: React.ReactNode;
+}
+
+const TableActionIcon = (props: TableActionIconProps) => {
+ return (
+
+ {
+ props.selectMenu(!props.selected);
+ e.stopPropagation();
+ }}
+ className={props.className}
+ >
+
+ {props.children}
+
+ {props.icon ? props.icon : null}
+
+
+ );
+};
+
+export default TableActionIcon;
diff --git a/app/client/src/components/designSystems/appsmith/TableColumnsVisibility.tsx b/app/client/src/components/designSystems/appsmith/TableColumnsVisibility.tsx
index 378dccc288..175372c25f 100644
--- a/app/client/src/components/designSystems/appsmith/TableColumnsVisibility.tsx
+++ b/app/client/src/components/designSystems/appsmith/TableColumnsVisibility.tsx
@@ -5,7 +5,6 @@ import {
PopoverInteractionKind,
Position,
Icon,
- Tooltip,
} from "@blueprintjs/core";
import { IconWrapper } from "constants/IconConstants";
import styled from "styled-components";
@@ -14,6 +13,7 @@ import { ReactComponent as VisibleIcon } from "assets/icons/control/columns-visi
import Button from "components/editorComponents/Button";
import { ReactTableColumnProps } from "widgets/TableWidget";
import { TableIconWrapper } from "components/designSystems/appsmith/TableStyledWrappers";
+import TableActionIcon from "components/designSystems/appsmith/TableActionIcon";
const DropDownWrapper = styled.div`
display: flex;
@@ -104,29 +104,18 @@ const TableColumnsVisibility = (props: TableColumnsVisibilityProps) => {
onClose={() => {
selectMenu(false);
}}
+ isOpen={selected}
>
- {
- selectMenu(true);
- }}
+ {
+ selectMenu(selected);
+ }}
>
-
-
-
-
-
-
+
+
{columns.map((option: ReactTableColumnProps, index: number) => (
{
onClose={() => {
selectMenu(false);
}}
+ isOpen={selected}
>
- {
- selectMenu(!selected);
+ selectMenu={(selected: boolean) => {
+ selectMenu(selected);
}}
className="t--table-compact-mode-toggle-btn"
>
-
-
-
-
-
-
+
+
{CompactModes.map((item: CompactModeItem, index: number) => {
return (
diff --git a/app/client/src/components/designSystems/appsmith/TableDataDownload.tsx b/app/client/src/components/designSystems/appsmith/TableDataDownload.tsx
index 7975f5caac..127122c536 100644
--- a/app/client/src/components/designSystems/appsmith/TableDataDownload.tsx
+++ b/app/client/src/components/designSystems/appsmith/TableDataDownload.tsx
@@ -1,10 +1,10 @@
import React from "react";
import { IconWrapper } from "constants/IconConstants";
-import { Tooltip } from "@blueprintjs/core";
import { Colors } from "constants/Colors";
import { ReactComponent as DownloadIcon } from "assets/icons/control/download-table.svg";
import { ReactTableColumnProps } from "widgets/TableWidget";
import { TableIconWrapper } from "components/designSystems/appsmith/TableStyledWrappers";
+import TableActionIcon from "components/designSystems/appsmith/TableActionIcon";
import { isString } from "lodash";
interface TableDataDownloadProps {
@@ -83,27 +83,16 @@ const TableDataDownload = (props: TableDataDownloadProps) => {
);
}
return (
- {
+ {
downloadTableData();
}}
className="t--table-download-btn"
>
-
-
-
-
-
-
+
+
);
};
diff --git a/app/client/src/components/designSystems/appsmith/TableFilters.tsx b/app/client/src/components/designSystems/appsmith/TableFilters.tsx
index 474a3a03b3..12ee0aab93 100644
--- a/app/client/src/components/designSystems/appsmith/TableFilters.tsx
+++ b/app/client/src/components/designSystems/appsmith/TableFilters.tsx
@@ -12,6 +12,7 @@ import { ReactComponent as FilterIcon } from "assets/icons/control/filter-icon.s
import { TableIconWrapper } from "components/designSystems/appsmith/TableStyledWrappers";
import Button from "components/editorComponents/Button";
import CascadeFields from "components/designSystems/appsmith/CascadeFields";
+import TableActionIcon from "components/designSystems/appsmith/TableActionIcon";
import {
ReactTableColumnProps,
Condition,
@@ -164,25 +165,21 @@ const TableFilters = (props: TableFilterProps) => {
}}
isOpen={selected}
>
- {
- selectMenu(true);
- e.stopPropagation();
+ icon={
+ showAddFilter ? (
+ {filters.length}
+ ) : null
+ }
+ selectMenu={(selected: boolean) => {
+ selectMenu(selected);
}}
>
-
-
-
- {showAddFilter ? (
- {filters.length}
- ) : null}
-
+
+
e.stopPropagation()}>
{filters.map((filter: ReactTableFilter, index: number) => {
diff --git a/app/client/src/widgets/TableWidget.tsx b/app/client/src/widgets/TableWidget.tsx
index 4146332681..f0ac357a69 100644
--- a/app/client/src/widgets/TableWidget.tsx
+++ b/app/client/src/widgets/TableWidget.tsx
@@ -360,9 +360,11 @@ class TableWidget extends BaseWidget {
);
}
componentDidUpdate(prevProps: TableWidgetProps) {
- if (
+ const tableDataUpdated =
JSON.stringify(this.props.tableData) !==
- JSON.stringify(prevProps.tableData) ||
+ JSON.stringify(prevProps.tableData);
+ if (
+ tableDataUpdated ||
JSON.stringify(this.props.filters) !==
JSON.stringify(prevProps.filters) ||
this.props.searchText !== prevProps.searchText ||
@@ -386,6 +388,11 @@ class TableWidget extends BaseWidget {
);
}
}
+ if (tableDataUpdated) {
+ super.updateWidgetMetaProperty("selectedRowIndices", []);
+ super.updateWidgetMetaProperty("selectedRows", []);
+ super.updateWidgetMetaProperty("selectedRowIndex", -1);
+ }
if (this.props.multiRowSelection !== prevProps.multiRowSelection) {
if (this.props.multiRowSelection) {
const selectedRowIndices = this.props.selectedRowIndex