MatTableDataSource не обновляется с помощью метода _updateChangeSubscription () - PullRequest
0 голосов
/ 28 мая 2019

У меня есть MatTableDataSource с некоторыми данными. Когда я делаю «обновление», я использую метод с именем «_updateChangeSubscription ()» для обновления таблицы, и это работает. Я хотел бы знать, как обновить таблицу, когда я делаю 'POST' или 'DELETE'. Я попробовал тот же метод выше, но безуспешно

Этот метод обновляет мою таблицу, потому что я использую _updateChangeSubscription ()

public updateWorkspace() {
        this.workspace['id'] = this.workspace._id;
        this.workspace.createdBy = null;
        this.workspace.createdAt = null;
        this.workspace.updatedBy = this.user;
        this.workspace.updatedAt = new Date();
        this.workspace.language = this.workspaceForm.value.language;
        this.workspace.description = this.workspaceForm.value.description;
        this.workspace.name = this.workspaceForm.value.name;
        this.workspacesService.updateWorkspace(this.workspace).subscribe((response) => {
            alert("SUCESSO")
            this.workspaces._updateChangeSubscription()
            this.workspaceForm.reset(); // fica vermelho os campos
            this.workspace = null;
        }, (error) => {
            alert("Ocorreu um erro ao tentar atualizar o Assunto")
        });
    }

этот метод не работает, метод _updateChangeSubscription ()

public updateWorkspace() {
        this.workspace['id'] = this.workspace._id;
        this.workspace.createdBy = null;
        this.workspace.createdAt = null;
        this.workspace.updatedBy = this.user;
        this.workspace.updatedAt = new Date();
        this.workspace.language = this.workspaceForm.value.language;
        this.workspace.description = this.workspaceForm.value.description;
        this.workspace.name = this.workspaceForm.value.name;
        this.workspacesService.updateWorkspace(this.workspace).subscribe((response) => {
            alert("SUCESSO")
            this.workspaces._updateChangeSubscription()
            this.workspaceForm.reset(); // fica vermelho os campos
            this.workspace = null;
        }, (error) => {
            alert("Ocorreu um erro ao tentar atualizar o Assunto")
        });
    }

Я бы хотел, чтобы все мои методы могли обновлять таблицу независимо, если она опубликована или удалена ....

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...