【问题标题】:How can I refresh the Kendo UI grid in Angular 2?如何在 Angular 2 中刷新 Kendo UI 网格?
【发布时间】:2017-06-10 02:06:48
【问题描述】:

我有一个使用 Angular 2 制作的 Kendo UI 网格。它是 crud 应用程序的一部分,我有一个删除按钮。删除后我希望网格自动刷新。

这是显示事件通知的网格:

<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._http.delete(this.link + notificationId,

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

在此之后,我再次创建了一个 http.get 来获取事件通知,但它不会自动更新网格,我必须刷新页面。

你知道如何刷新网格吗?

谢谢!

【问题讨论】:

  • 我知道这是旧的,但你有没有发现如何刷新 Angular2+ 网格?

标签: angular kendo-ui kendo-grid


【解决方案1】:

您可以在删除订阅的成功处理程序中从 EventsNotificationSetup 中删除此项目,并且由于双向数据绑定,您的网格将按照我没记错的方式进行更新

【讨论】:

    猜你喜欢
    • 2018-03-12
    • 2015-03-28
    • 2013-05-04
    • 2014-03-18
    • 2017-04-16
    • 2017-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多