Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I refresh the Kendo UI grid in Angular 2?

I have a Kendo UI grid made with Angular 2 .It's part of a crud application ,where I have a delete button .After the delete I want the grid to refresh automatically.

This is the grid that shows the event's notifications :

<kendo-grid [data]="EventsNotificationSetup">

        <kendo-grid-command-column title="" width="200">
            <template >
                <button (click)="EditModal.open()" kendoGridEditCommand  kendoButton  [icon]="'pencil'">Edit</button>
                <button (click) = deleteEventNotification(dataItem.id) kendoGridRemoveCommand kendoButton [primary]="true"  [icon]="'trash'">Remove</button>


            </template>
        </kendo-grid-command-column>

        </kendo-grid>

This the delete code where I literally deleted the record :

this._http.delete(this.link + notificationId,

            {
                headers: new Headers({
                    'Content-Type': 'application/json'
                })
            })
            .map(res => res.json()).subscribe();

After this I made again an http.get to get the event notifications but it does not update automatically the grid,I have to refresh the page.

Do you know how can I refresh the grid?

Thanks!

like image 709
Adrian Balasa Avatar asked Nov 08 '22 02:11

Adrian Balasa


1 Answers

You could remove this item from EventsNotificationSetup in success handler of delete subscription and because of two-way data binding your grid will be updated as I remember correctly

like image 81
Mickey P Avatar answered Nov 15 '22 08:11

Mickey P