Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Fix Export button ignores permanent filter from List #3083

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/ra-ui-materialui/src/list/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const ListView = ({
// component props
actions,
aside,
filter,
filters,
bulkActions, // deprecated
bulkActionButtons,
Expand Down Expand Up @@ -138,6 +139,7 @@ export const ListView = ({
actions={actions}
bulkActions={bulkActions}
exporter={exporter}
permanentFilter={filter}
/>
)}
<div key={version}>
Expand Down
3 changes: 2 additions & 1 deletion packages/ra-ui-materialui/src/list/ListActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const Actions = ({
displayedFilters,
exporter,
filterValues,
permanentFilter,
hasCreate,
basePath,
selectedIds,
Expand Down Expand Up @@ -46,7 +47,7 @@ const Actions = ({
disabled={total === 0}
resource={resource}
sort={currentSort}
filter={filterValues}
filter={{ ...filterValues, ...permanentFilter }}
exporter={exporter}
/>
)}
Expand Down
8 changes: 7 additions & 1 deletion packages/ra-ui-materialui/src/list/ListToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const styles = createStyles({
const ListToolbar = ({
classes,
filters,
filterValues, // dynamically set via the UI by the user
permanentFilter, // set in the List component by the developer
actions,
bulkActions,
exporter,
Expand All @@ -21,6 +23,7 @@ const ListToolbar = ({
{filters &&
React.cloneElement(filters, {
...rest,
filterValues,
context: 'form',
})}
<span />
Expand All @@ -31,14 +34,17 @@ const ListToolbar = ({
bulkActions,
exporter,
filters,
...actions.props
filterValues,
permanentFilter,
...actions.props,
})}
</Toolbar>
);

ListToolbar.propTypes = {
classes: PropTypes.object,
filters: PropTypes.element,
permanentFilter: PropTypes.object,
actions: PropTypes.element,
bulkActions: PropTypes.oneOfType([PropTypes.element, PropTypes.bool]),
exporter: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
Expand Down