-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: when a table switches paging, no form parameters will be carried (…
…#4607) * fix: when a table switches paging, no form parameters will be carried * chore: typo
- Loading branch information
Showing
9 changed files
with
67 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { VxeGridProps } from 'vxe-table'; | ||
|
||
import type { VxeGridApi } from './api'; | ||
|
||
import { isFunction } from '@vben/utils'; | ||
|
||
export function extendProxyOptions( | ||
api: VxeGridApi, | ||
options: VxeGridProps, | ||
getFormValues: () => Record<string, any>, | ||
) { | ||
[ | ||
'query', | ||
'querySuccess', | ||
'queryError', | ||
'queryAll', | ||
'queryAllSuccess', | ||
'queryAllError', | ||
].forEach((key) => { | ||
extendProxyOption(key, api, options, getFormValues); | ||
}); | ||
} | ||
|
||
function extendProxyOption( | ||
key: string, | ||
api: VxeGridApi, | ||
options: VxeGridProps, | ||
getFormValues: () => Record<string, any>, | ||
) { | ||
const { proxyConfig } = options; | ||
const configFn = (proxyConfig?.ajax as any)?.[key]; | ||
if (!isFunction(configFn)) { | ||
return options; | ||
} | ||
|
||
const wrapperFn = async (params: any, _formValues: any, ...args: any[]) => { | ||
const formValues = getFormValues(); | ||
const data = await configFn(params, formValues, ...args); | ||
return data; | ||
}; | ||
api.setState({ | ||
gridOptions: { | ||
proxyConfig: { | ||
ajax: { | ||
[key]: wrapperFn, | ||
}, | ||
}, | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters