add loadDataOnceFetchOnFilter

This commit is contained in:
rickcole 2019-12-26 20:13:23 +08:00
parent baf68d6b71
commit 650c83e45e
2 changed files with 10 additions and 2 deletions

View File

@ -69,6 +69,7 @@ interface CRUDProps extends RendererProps {
syncResponse2Query?: boolean;
keepItemSelectionOnPageChange?: boolean;
loadDataOnce?: boolean;
loadDataOnceFetchOnFilter?: boolean; // 在开启loadDataOnce时filter时是否去重新请求api
source?: string;
}
@ -114,6 +115,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
'labelTpl',
'labelField',
'loadDataOnce',
'loadDataOnceFetchOnFilter',
'source'
];
static defaultProps = {
@ -129,7 +131,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
silentPolling: false,
filterTogglable: false,
filterDefaultVisible: true,
loadDataOnce: false
loadDataOnce: false,
loadDataOnceFetchOnFilter: true
};
control: any;
@ -685,6 +688,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
pickerMode,
env,
loadDataOnce,
loadDataOnceFetchOnFilter,
source
} = this.props;
@ -720,6 +724,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
autoAppend: true,
forceReload,
loadDataOnce,
loadDataOnceFetchOnFilter,
source,
silent,
pageField,

View File

@ -110,6 +110,7 @@ export const CRUDStore = ServiceStore.named('CRUDStore')
options?: fetchOptions & {
forceReload?: boolean;
loadDataOnce?: boolean; // 配置数据是否一次性加载,如果是这样,由前端来完成分页,排序等功能。
loadDataOnceFetchOnFilter?: boolean; // 在开启loadDataOnce时filter时是否去重新请求api
source?: string; // 支持自定义属于映射,默认不配置,读取 rows 或者 items
loadDataMode?: boolean;
syncResponse2Query?: boolean;
@ -120,6 +121,7 @@ export const CRUDStore = ServiceStore.named('CRUDStore')
options: fetchOptions & {
forceReload?: boolean;
loadDataOnce?: boolean; // 配置数据是否一次性加载,如果是这样,由前端来完成分页,排序等功能。
loadDataOnceFetchOnFilter?: boolean; // 在开启loadDataOnce时filter时是否去重新请求api
source?: string; // 支持自定义属于映射,默认不配置,读取 rows 或者 items
loadDataMode?: boolean;
syncResponse2Query?: boolean;
@ -127,7 +129,8 @@ export const CRUDStore = ServiceStore.named('CRUDStore')
) {
try {
if (
options.forceReload === false &&
(options.forceReload === false ||
options.loadDataOnceFetchOnFilter === false) &&
options.loadDataOnce &&
self.total
) {