angular/components

Document creating a custom sort-header control

已關閉

#13,177 建立於 2018年9月18日

 (1 則留言) (2 個反應) (0 位負責人)TypeScript (6,650 個分叉)batch import
P4area: material/sortdocshelp wanted

倉庫指標

星標
 (24,044 顆星)
PR 合併指標
 (平均合併 3天 12小時) (30 天內合併 98 個 PR)

描述

Bug, feature request, or proposal:

Proposal

What is the expected behavior?

Be able to add custom controls to headers along with matSort

image

What is the current behavior?

It is possible to add custom controls e.g.

<ng-container matColumnDef="to">
    <mat-header-cell *matHeaderCellDef>
      <div class="vbox">
        To
        <input [(ngModel)]="filter.to">
      </div>
    </mat-header-cell>
    <mat-cell *matCellDef="let element">{{element.to}}</mat-cell>
  </ng-container>

However this does not work with matSort

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue. StackBlitz starter: https://goo.gl/wwnhMV

What is the use-case or motivation for changing an existing behavior?

I need individual filter controls for each column in the table, all the examples use a single filter field.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Is there anything else we should know?

貢獻者指南