From 14403cc851500f2c62b8376f55fe4cbea55f775b Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 5 May 2023 16:33:40 +0300 Subject: [PATCH] connect PolicyTable key to store --- .../Components/Calculation/Form/ELT/Components/PolicyTable.jsx | 3 ++- apps/web/stores/tables/elt/policy.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/Components/Calculation/Form/ELT/Components/PolicyTable.jsx b/apps/web/Components/Calculation/Form/ELT/Components/PolicyTable.jsx index 3ce7a82..08da848 100644 --- a/apps/web/Components/Calculation/Form/ELT/Components/PolicyTable.jsx +++ b/apps/web/Components/Calculation/Form/ELT/Components/PolicyTable.jsx @@ -4,7 +4,7 @@ import { Table } from 'ui/antd'; export const PolicyTable = observer(({ getter, ...props }) => { const { $tables } = useStore(); - const { getValues, setSelectedKey } = getter($tables.elt); + const { getValues, setSelectedKey, getSelectedRow } = getter($tables.elt); return ( { onSelect: (record) => { setSelectedKey(record.key); }, + selectedRowKeys: getSelectedRow ? [getSelectedRow.key] : [], type: 'radio', }} {...props} diff --git a/apps/web/stores/tables/elt/policy.ts b/apps/web/stores/tables/elt/policy.ts index d99796f..135dcae 100644 --- a/apps/web/stores/tables/elt/policy.ts +++ b/apps/web/stores/tables/elt/policy.ts @@ -62,7 +62,7 @@ export default class PolicyStore { }; public resetSelectedKey = () => { - this.selectedKey = null; + if (this.setSelectedKey !== null) this.selectedKey = null; }; public get getSelectedRow() {