How to refresh Angular kendo-grid

1 Answer 10792 Views
General Discussions
bryian
Top achievements
Rank 1
bryian asked on 25 Feb 2018, 08:00 AM

Two questions.

1. How to reload/refresh the kendo-grid after update? 

2. How to maintain the state (filter/page number, etc...) after the reload/refresh?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 26 Feb 2018, 02:30 PM
Hi Bryian,

Manipulating the collection the Grid is bound to (or replacing it with a new one altogether) will result in rerendering the Grid with the latest data.

You can store the Grid state and obtain it from local/session storage, remote service or via any other custom approach, and bind the Grid's pageSize, skip, filter, sort, and group properties to the ones of the saved state object, e.g.:

https://plnkr.co/edit/RB4d49KmTmsre3jtIGKQ?p=preview

Make sure to test in a separate window mode so that you have access to the local storage:



I hope this helps.

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
bryian
Top achievements
Rank 1
commented on 28 Feb 2018, 12:25 AM

Good to know.
goutham
Top achievements
Rank 1
commented on 30 May 2018, 08:12 PM

Hi Dimiter Topalov,

can you show same with Rest web service call? Do you have any example?

I want the grid data to be refreshed   with the response i get from rest webservice call.

Thanks!!

Svet
Telerik team
commented on 01 Jun 2018, 11:25 AM

Hi Goutham,

The grid's data binding to remote source is demonstrated in the following article:

https://www.telerik.com/kendo-angular-ui/components/grid/data-binding/

I have further modified the provided example by the article above, so that it implements filtering as well. Check it at the following link:

https://plnkr.co/edit/mypn0fwCxqmYJeaB2osh?p=preview

Note, how on each (dataStateChane) event - filtering, sorting, paging an HTTP request is sent. (check the browser's network tab). When the data is returned it is displayed by the grid.

I hope this helps.

Regards,
Svetlin
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
General Discussions
Asked by
bryian
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Share this question
or