We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Refresh Grid after custom toolbar button API click

Hi!

I have a grid where a custom toolbar using toolbarclickhandler (source) button calls an API Post method (as posted here) , it all runs correctly but the grid is not refreshed after the record is added. I tried using a Grid.Refresh() inside OnAfterRender() but that runs before the api call.

How can I refresh the grid after that API post ends? 

PS.:  As a helper, I want the same call that the built in Add toolbar function runs after adding the record.



3 Replies 1 reply marked as answer

MS Monisha Saravanan Syncfusion Team October 7, 2022 12:25 PM UTC


Hi Francisco,


Greetings from Syncfusion support.


We have checked your query and we suspect that you are facing issues with Grid refresh instead of calling Grid refresh we suggest you to fetch and assign the datasource again to the DataSource property of the Grid. So that it will reflect properly with the new Dataset.


If the reported issue still persist then kindly share the below details to validate further at our end.


  1. Share us the entire Grid code snippet.
  2. Share us the video demonstration of the issue.
  3. If possible kindly share us the issue reproduceable sample.


The above-requested details will be very helpful for us to validate the reported query at our end and provide the solution as early as possible.


Regards,

Monisha




Marked as answer

FR Francisco October 10, 2022 02:54 PM UTC

Thank you Monisha,


Refreshing the DataSource worked.



VN Vignesh Natarajan Syncfusion Team October 11, 2022 04:12 AM UTC

Hi Francisco, 


Thanks for the update. 


We are glad to hear that you have resolved your query using our solution. Please get back to us if you have further queries.


Regards,

Vignesh Natarajan


Loader.
Live Chat Icon For mobile
Up arrow icon