Skip to content

Commit

Permalink
Merge pull request #3083 from marmelab/fix-export-permanent-filter
Browse files Browse the repository at this point in the history
[RFR] Fix Export button ignores permanent filter from List
  • Loading branch information
Gildas Garcia authored Apr 2, 2019
2 parents dd996b0 + 63ac7c6 commit d83ffd8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
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

0 comments on commit d83ffd8

Please sign in to comment.