angular - 如何在没有输入且仅使用日历图标的情况下使用日期选择器
问题描述
我正在研究数据表过滤器,我想使用日历图标通过单击数据表标题来设置日期过滤器。
到那时,我已经在我的数据表标题上显示了一个日历图标,我想知道如何将它用作日期选择器?
我的 HTML:
<ng-container matColumnDef="Date">
<mat-header-cell *matHeaderCellDef fxHide mat-sor t-header fxShow.gt-md>
Date de l'opération
<mat-icon>
calendar_today
</mat-icon>
</mat-header-cell>
<mat-cell *matCellDef="let element" fxHide fxShow.gt-md>
<p class="category text-truncate">
{{element.CreatedDateGmt}}
</p>
</mat-cell>
</ng-container>
解决方案
您可以使用垫子菜单,并在垫子日历中,从此SO中删除 stopPropagation 的“div”...
<button mat-icon-button [matMenuTriggerFor]="appMenu">
<mat-icon>calendar_today</mat-icon>
</button>
<mat-menu #appMenu="matMenu">
<mat-calendar #calendar
(selectedChange)="select($event,calendar)"
[dateClass]="isSelected">
</mat-calendar>
</mat-menu>
推荐阅读
- php - 使用 Woocommerce 上的 URL 为不止一种产品定制价格
- wordpress - 是否可以使用不同名称的同一张图片而不复制它?
- github - Github push origin master 和 Token 认证
- http - Jmeter HTTP 连接和断开连接
- python - 如何将修补后的图像加载到 Dataloader 以供神经网络使用
- javascript - 如何使用角度访问保存在标头中的令牌
- pip - ubuntu16.04 pip3 升级后坏了
- java - Java - 解析第二个 csv 文件以覆盖一个值
- google-apps-script - 一系列函数运行中的多个 SpreadsheetApp.flush()
- vb.net - 如何在 vb.net 中对整数和日期时间之间的日期时间小时进行求和