Forum Discussion
Samaresh Das
Apr 04, 2017Copper Contributor
How to refresh SPFX webpart
I am developing webpart with new SharePoint Framework. I notice when user changed any value in property it refresh/reload the webpart. I want to refresh/reload the web part when user click on a butto...
Samaresh Das
Apr 05, 2017Copper Contributor
Hi Paul,
I have tried this but it says Render function undefine. Gulp serve command bundle all type script in its own way. For this reason i wanted something from framwork so that i can invoke this method in proper channel. But I am able to change the DOM without refresh the webpart.
I have tried this but it says Render function undefine. Gulp serve command bundle all type script in its own way. For this reason i wanted something from framwork so that i can invoke this method in proper channel. But I am able to change the DOM without refresh the webpart.
Dec 13, 2018
Did you get this resolved?
Samaresh Das wrote:
Hi Paul,
I have tried this but it says Render function undefine.
It appears this doesn't have the proper reference. By chance are you calling it from within an event handler? If so, the challenge is that this within the handler (such as clicking a button) is tied to the thing that triggered the event... in this case a button. You want to bind the event handler function to the web part itself.
Assuming you have something like:
<button onClick="this._buttonClickHandler"></button>
You can fix that by changing your function declaration:
private _buttonClickHandler = (): void => { this.render(); }