在棱角材料中不会发生排序

我正在尝试为带有角材料的垫子桌子添加排序功能。我将手形光标放在列上,单击时无法看到它的动作。我已经将属性“ matsort”添加到表级别,并且为mat-h​​eader-cell选择器添加了“ mat-sort-header”。 2)其次,我无法查看我的“操作”列进行编辑和删除。 以下是我的代码:

app-component.html:

  <mat-table [dataSource]="emplist" matSort>
    <ng-container matColumnDef="Emp_Id">
      <mat-header-cell *matHeaderCellDef mat-sort-header> ID </mat-header-cell>
      <mat-cell *matCellDef="let data"> {{data.Emp_Id}} </mat-cell>
      </ng-container>
    
      <ng-container matColumnDef="Emp_Name">
      <mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>
      <mat-cell *matCellDef="let data"> {{data.Emp_Name}} </mat-cell>
      </ng-container>
     
      <ng-container matColumnDef="Emp_Gender">
      <mat-header-cell *matHeaderCellDef mat-sort-header>  Gender </mat-header-cell>
      <mat-cell *matCellDef="let data"> {{data.Emp_Gender | settingGender}} </mat-cell>
      </ng-container>

      <ng-container matColumnDef="Emp_Deptname">
        <mat-header-cell *matHeaderCellDef mat-sort-header> Department </mat-header-cell>
        <mat-cell *matCellDef="let data"> {{data.Emp_Deptname}} </mat-cell>
        </ng-container>

        <ng-container matColumnDef="Emp_Salary">
          <mat-header-cell *matHeaderCellDef mat-sort-header> Salary </mat-header-cell>
          <mat-cell *matCellDef="let data"> {{data.Emp_Salary}} </mat-cell>
          </ng-container>
     
      
      <ng-container matColumnDef="action">
      <mat-header-cell *matHeaderCellDef> Actions </mat-header-cell>
      <mat-cell *matCellDef="let data">
      <button mat-button color="primary" (click)="EditEmployee(data.Emp_Id)">Edit</button>
      <button mat-button color="warn" (click)="DeleteEmployee(data.Emp_Id)">Delete</button>
      </mat-cell>
      </ng-container>
     
      <mat-header-row *matHeaderRowDef="columndefs"></mat-header-row>
      <mat-row *matRowDef="let row; columns: columndefs;"></mat-row>

      <!-- <mat-paginator [pageSizeOptions]="[5, 10, 25, 100]"></mat-paginator> -->
     </mat-table>

app-component.ts:

import { Component, OnInit, ViewChild } from '@angular/core';
import { EmployeeinfoService } from './employeeinfo.service';
import { FormBuilder, FormGroup, FormControl,Validators } from '@angular/forms';
import {Sort,MatSort} from '@angular/material/sort';
import { Employee } from './employee';
import {MatTableDataSource} from '@angular/material/table';


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  columndefs : any[] = ['Emp_Id','Emp_Name',"Emp_Gender","Emp_Deptname","Emp_Salary"];
  @ViewChild(MatSort) sort: MatSort;
  title = 'HttpClient';
  emplist : any;
  deptlist :any;
  myform : FormGroup;
  result : string;
  submitted : boolean = false;
  btntxt : string = "Create";
  public dataSource = new MatTableDataSource<Employee>();
  //constructor
  constructor(public serviceref : EmployeeinfoService, frmbldr : FormBuilder){
    this.myform = frmbldr.group({
      Emp_Name : new FormControl("",Validators.required),
      Emp_Gender : new FormControl("",Validators.required),
      Emp_Deptno : new FormControl("",Validators.required),
      Emp_Salary : new FormControl("",Validators.required),
      
    })
  }

  //ngOnInit
  ngOnInit(){
    this.dataSource.sort = this.sort;
    //Get Employees:
    this.GetEmployeesData();
    
   }
}

当前,我可以查看具有鼠标悬停排序效果的数据和列,但是排序没有发生