Rerender paginated list on collection update

Rerender paginated list on collection update
This commit is contained in:
Omar 2021-07-29 10:53:22 +01:00
parent 6acf4addf4
commit 9572960ff6
2 changed files with 10 additions and 6 deletions

View File

@ -126,7 +126,8 @@ export default class HeroWebpartWebPart extends BaseClientSideWebPart<IHeroWebpa
hideLinkUploadTab: true
})
);
}
},
required: true
}
],
disabled: false

View File

@ -70,11 +70,14 @@ export default class HeroWebpart extends React.Component<IHeroWebpartProps, IHer
public componentDidUpdate(prevProps : IHeroWebpartProps, prevState : IHeroState) : void
{
// If properties have changed bind it and update webpart
if(this.props.items !== prevProps.items || this.state.items !== prevState.items)
{
this.setState({items:this.props.items});
}
// If properties have changed bind it and update webpart
if(this.props.items !== prevProps.items || this.state.items !== prevState.items)
{
this.setState({items:this.props.items});
if(this.props.showAllHero){
this._getPage(this.state.currentPage);
}
}
}
public render(): React.ReactElement<IHeroWebpartProps> {