mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
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:
parent
514a63edbf
commit
e4fd3679d5
@ -2,9 +2,7 @@
|
|||||||
"version": "1.4.0-alpha.11",
|
"version": "1.4.0-alpha.11",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
"npmClientArgs": [
|
"npmClientArgs": ["--ignore-engines"],
|
||||||
"--ignore-engines"
|
|
||||||
],
|
|
||||||
"command": {
|
"command": {
|
||||||
"version": {
|
"version": {
|
||||||
"forcePublish": true,
|
"forcePublish": true,
|
||||||
|
@ -181,7 +181,7 @@ export const SubTable: any = observer(
|
|||||||
return {
|
return {
|
||||||
current: currentPage > page ? page : currentPage,
|
current: currentPage > page ? page : currentPage,
|
||||||
pageSize: pageSize || 10,
|
pageSize: pageSize || 10,
|
||||||
total: field?.value?.length,
|
total: field?.value,
|
||||||
onChange: (page, pageSize) => {
|
onChange: (page, pageSize) => {
|
||||||
setCurrentPage(page);
|
setCurrentPage(page);
|
||||||
setPageSize(pageSize);
|
setPageSize(pageSize);
|
||||||
|
@ -200,23 +200,23 @@ const useTableColumns = (props: { showDel?: any; isSubTable?: boolean }, paginat
|
|||||||
render: (v, record, index) => {
|
render: (v, record, index) => {
|
||||||
if (props.showDel(record)) {
|
if (props.showDel(record)) {
|
||||||
return (
|
return (
|
||||||
<CloseOutlined
|
<div
|
||||||
style={{ cursor: 'pointer', color: 'gray' }}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
return action(() => {
|
return action(() => {
|
||||||
const fieldIndex = (current - 1) * pageSize + index;
|
const fieldIndex = (current - 1) * pageSize + index;
|
||||||
|
const deleteCount = field.value[fieldIndex] ? 1 : 2;
|
||||||
spliceArrayState(field, {
|
spliceArrayState(field, {
|
||||||
startIndex: fieldIndex,
|
startIndex: fieldIndex,
|
||||||
deleteCount: 1,
|
deleteCount: deleteCount,
|
||||||
});
|
|
||||||
field.value.splice(fieldIndex, 1);
|
|
||||||
setTimeout(() => {
|
|
||||||
field.value[field.value.length] = null;
|
|
||||||
});
|
});
|
||||||
|
field.value.splice(fieldIndex, deleteCount);
|
||||||
|
field.setInitialValue(field.value);
|
||||||
return field.onInput(field.value);
|
return field.onInput(field.value);
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
<CloseOutlined style={{ cursor: 'pointer', color: 'gray' }} />
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user