fix: pagination count not updating after deleting data in subtable (#5648)

* fix: pagination count not updating after deleting data in subtable

* fix: bug

* fix: bug
This commit is contained in:
Katherine 2024-11-15 12:58:57 +08:00 committed by GitHub
parent 514a63edbf
commit e4fd3679d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 12 deletions

View File

@ -2,9 +2,7 @@
"version": "1.4.0-alpha.11",
"npmClient": "yarn",
"useWorkspaces": true,
"npmClientArgs": [
"--ignore-engines"
],
"npmClientArgs": ["--ignore-engines"],
"command": {
"version": {
"forcePublish": true,

View File

@ -181,7 +181,7 @@ export const SubTable: any = observer(
return {
current: currentPage > page ? page : currentPage,
pageSize: pageSize || 10,
total: field?.value?.length,
total: field?.value,
onChange: (page, pageSize) => {
setCurrentPage(page);
setPageSize(pageSize);

View File

@ -200,23 +200,23 @@ const useTableColumns = (props: { showDel?: any; isSubTable?: boolean }, paginat
render: (v, record, index) => {
if (props.showDel(record)) {
return (
<CloseOutlined
style={{ cursor: 'pointer', color: 'gray' }}
<div
onClick={() => {
return action(() => {
const fieldIndex = (current - 1) * pageSize + index;
const deleteCount = field.value[fieldIndex] ? 1 : 2;
spliceArrayState(field, {
startIndex: fieldIndex,
deleteCount: 1,
});
field.value.splice(fieldIndex, 1);
setTimeout(() => {
field.value[field.value.length] = null;
deleteCount: deleteCount,
});
field.value.splice(fieldIndex, deleteCount);
field.setInitialValue(field.value);
return field.onInput(field.value);
});
}}
/>
>
<CloseOutlined style={{ cursor: 'pointer', color: 'gray' }} />
</div>
);
}
return;