reset page to 1 when changing filters
This commit is contained in:
parent
e395a186b7
commit
ef4142caf9
@ -39,7 +39,7 @@ export default function Sidebar(props : SidebarProps) {
|
||||
variant='standard'
|
||||
sx={{width: '100%'}}
|
||||
value={props.filters.namePart}
|
||||
onChange={e => props.onChange(Object.assign({}, {...props.filters}, {namePart: (e.target as any).value}))}
|
||||
onChange={e => props.onChange(Object.assign({}, {...props.filters}, {namePart: (e.target as any).value, currentPage: 1}))}
|
||||
/>
|
||||
</Box>
|
||||
<Divider />
|
||||
@ -47,7 +47,7 @@ export default function Sidebar(props : SidebarProps) {
|
||||
<Typography component='legend'>Search by Firm Name Only</Typography>
|
||||
<Switch
|
||||
value={props.filters.nameOnly}
|
||||
onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {nameOnly: value}))}
|
||||
onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {nameOnly: value, currentPage: 1}))}
|
||||
/>
|
||||
</Box>
|
||||
<Divider />
|
||||
@ -60,7 +60,7 @@ export default function Sidebar(props : SidebarProps) {
|
||||
options={cities}
|
||||
value={props.filters.cities}
|
||||
getOptionLabel={capitaliseFirstLetter}
|
||||
onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {cities: value}))}
|
||||
onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {cities: value, currentPage: 1}))}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
@ -81,7 +81,7 @@ export default function Sidebar(props : SidebarProps) {
|
||||
precision={0.5}
|
||||
value={props.filters.minRating}
|
||||
size='medium'
|
||||
onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {minRating: value}))}
|
||||
onChange={(_, value) => props.onChange(Object.assign({}, {...props.filters}, {minRating: value, currentPage: 1}))}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid size={6}>
|
||||
@ -89,7 +89,7 @@ export default function Sidebar(props : SidebarProps) {
|
||||
<Select
|
||||
labelId='ratings-label'
|
||||
value={props.filters.ratingsProvider}
|
||||
onChange={(e : SelectChangeEvent) => props.onChange(Object.assign({}, {...props.filters}, {ratingsProvider: (e.target as any).value}))}
|
||||
onChange={(e : SelectChangeEvent) => props.onChange(Object.assign({}, {...props.filters}, {ratingsProvider: (e.target as any).value, currentPage: 1}))}
|
||||
>
|
||||
{ratingsProviders.map(provider => {
|
||||
return (
|
||||
@ -121,7 +121,7 @@ export default function Sidebar(props : SidebarProps) {
|
||||
<Select
|
||||
labelId='sort-label'
|
||||
value={props.filters.sortBy}
|
||||
onChange={(e : SelectChangeEvent) => props.onChange(Object.assign({}, {...props.filters}, {sortBy: (e.target as any).value}))}
|
||||
onChange={(e : SelectChangeEvent) => props.onChange(Object.assign({}, {...props.filters}, {sortBy: (e.target as any).value, currentPage: 1}))}
|
||||
>
|
||||
{sortingOptions.map(option => {
|
||||
return (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user