From 01bc463e2a42b2b12485c5b1fc32d88357af1cc8 Mon Sep 17 00:00:00 2001 From: liaoxuezhi Date: Thu, 11 Jul 2019 20:29:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Table=20quickEdit=20?= =?UTF-8?q?=E5=86=85=E8=81=94=E6=A8=A1=E5=BC=8F=E4=BF=AE=E6=94=B9=E5=AE=8C?= =?UTF-8?q?=E5=A4=B1=E5=8E=BB=E7=84=A6=E7=82=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Form/Table.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderers/Form/Table.tsx b/src/renderers/Form/Table.tsx index dbb4dad02..3542d76be 100644 --- a/src/renderers/Form/Table.tsx +++ b/src/renderers/Form/Table.tsx @@ -73,7 +73,7 @@ export default class FormTable extends React.Component { ]; entries:Map; - entityId: number = 0; + entityId: number = 1; subForms:any = {}; constructor(props:TableProps) { super(props); @@ -513,12 +513,16 @@ export default class FormTable extends React.Component { newValue.splice(rowIndex, 0, data); }); } else { + const idx = rowIndexes as number; + const origin = newValue[idx]; const data = { - ...newValue.splice(rowIndexes as number, 1)[0], + ...newValue.splice(idx, 1)[0], ...diff }; newValue.splice(rowIndexes as number, 0, data); + this.entries.set(data, this.entries.get(origin) || this.entityId++); + this.entries.delete(origin); } onChange(newValue);