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'
|
variant='standard'
|
||||||
sx={{width: '100%'}}
|
sx={{width: '100%'}}
|
||||||
value={props.filters.namePart}
|
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>
|
</Box>
|
||||||
<Divider />
|
<Divider />
|
||||||
@ -47,7 +47,7 @@ export default function Sidebar(props : SidebarProps) {
|
|||||||
<Typography component='legend'>Search by Firm Name Only</Typography>
|
<Typography component='legend'>Search by Firm Name Only</Typography>
|
||||||
<Switch
|
<Switch
|
||||||
value={props.filters.nameOnly}
|
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>
|
</Box>
|
||||||
<Divider />
|
<Divider />
|
||||||
@ -60,7 +60,7 @@ export default function Sidebar(props : SidebarProps) {
|
|||||||
options={cities}
|
options={cities}
|
||||||
value={props.filters.cities}
|
value={props.filters.cities}
|
||||||
getOptionLabel={capitaliseFirstLetter}
|
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) => (
|
renderInput={(params) => (
|
||||||
<TextField
|
<TextField
|
||||||
{...params}
|
{...params}
|
||||||
@ -81,7 +81,7 @@ export default function Sidebar(props : SidebarProps) {
|
|||||||
precision={0.5}
|
precision={0.5}
|
||||||
value={props.filters.minRating}
|
value={props.filters.minRating}
|
||||||
size='medium'
|
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>
|
||||||
<Grid size={6}>
|
<Grid size={6}>
|
||||||
@ -89,7 +89,7 @@ export default function Sidebar(props : SidebarProps) {
|
|||||||
<Select
|
<Select
|
||||||
labelId='ratings-label'
|
labelId='ratings-label'
|
||||||
value={props.filters.ratingsProvider}
|
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 => {
|
{ratingsProviders.map(provider => {
|
||||||
return (
|
return (
|
||||||
@ -121,7 +121,7 @@ export default function Sidebar(props : SidebarProps) {
|
|||||||
<Select
|
<Select
|
||||||
labelId='sort-label'
|
labelId='sort-label'
|
||||||
value={props.filters.sortBy}
|
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 => {
|
{sortingOptions.map(option => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user