diff --git a/build/api/admin.api.md b/build/api/admin.api.md index ac7b08f751..7ca7ab6d7d 100644 --- a/build/api/admin.api.md +++ b/build/api/admin.api.md @@ -800,10 +800,13 @@ export const DataGridPageRenderer: React.NamedExoticComponent({ stateComponent, stateProps, ...props }: DataGridScopeProps) => JSX.Element; +export const DataGridScope: ({ stateComponent, stateProps, skipBindingStateUpdateAfterPersist, refreshDataBindingOnPersist, ...props }: DataGridScopeProps) => JSX.Element; // @public (undocumented) -export type DataGridScopeProps = PropsWithChildren> & DataBindingProviderStateComponent; +export type DataGridScopeProps = PropsWithChildren> & DataBindingProviderStateComponent & { + refreshDataBindingOnPersist?: boolean; + skipBindingStateUpdateAfterPersist?: boolean; +}; // @public (undocumented) export const DefaultElement: FunctionComponent; diff --git a/packages/admin/src/components/pageRouting/Scopes/DataGridScope.tsx b/packages/admin/src/components/pageRouting/Scopes/DataGridScope.tsx index 23112db6af..eed59145c3 100644 --- a/packages/admin/src/components/pageRouting/Scopes/DataGridScope.tsx +++ b/packages/admin/src/components/pageRouting/Scopes/DataGridScope.tsx @@ -7,13 +7,22 @@ import { scopeComponent } from './scopeComponent' export type DataGridScopeProps = & PropsWithChildren> & DataBindingProviderStateComponent + & { + refreshDataBindingOnPersist?: boolean + skipBindingStateUpdateAfterPersist?: boolean + } /** * @group Scopes */ export const DataGridScope = scopeComponent( - ({ stateComponent, stateProps, ...props }: DataGridScopeProps) => ( - + ({ stateComponent, stateProps, skipBindingStateUpdateAfterPersist, refreshDataBindingOnPersist, ...props }: DataGridScopeProps) => ( + ), diff --git a/packages/react-datagrid/src/grid/createDataGrid.tsx b/packages/react-datagrid/src/grid/createDataGrid.tsx index e1bc595869..dbd4e2705d 100644 --- a/packages/react-datagrid/src/grid/createDataGrid.tsx +++ b/packages/react-datagrid/src/grid/createDataGrid.tsx @@ -36,6 +36,8 @@ const dummyStateMethods: DataGridStateMethods = { const createInitialState = (props: DataGridProps<{}>, environment: Environment): DataGridState => { const columns = extractDataGridColumns(props.children, environment) + const entities = QueryLanguage.desugarQualifiedEntityList({ entities: props.entities }, environment) + const filter = { and: [entities.filter ?? {}] } return { columns, paging: { @@ -46,8 +48,8 @@ const createInitialState = (props: DataGridProps<{}>, environment: Environment): filterArtifacts: {}, orderDirections: {}, orderBy: [], - entities: QueryLanguage.desugarQualifiedEntityList({ entities: props.entities }, environment), - filter: { and: [{}] }, + entities: entities, + filter, layout: 'default', } }