Angular 如何将单击事件添加到kendoGridCellTemplate
我试图弄清楚如何将单击事件处理程序添加到剑道网格单元中。 这是我的密码:Angular 如何将单击事件添加到kendoGridCellTemplate,angular,kendo-ui,Angular,Kendo Ui,我试图弄清楚如何将单击事件处理程序添加到剑道网格单元中。 这是我的密码: <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex"> <div class="w-100 timeline-cell-container"> <ng-container *ngFor="let item of
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
<div class="w-100 timeline-cell-container">
<ng-container *ngFor="let item of getTimelineField(parentColumn.field, dataItem, true); let i=index">
<div class="timeline-cell position-absolute" [ngStyle]="getTimelineCellStyle(item)">
{{ item.value }}
</div>
</ng-container>
</div>
</ng-template>
必须用标记包装标记,然后才能使用单元格单击事件发射器cellClick=cellClickHandler$event
查看此文档了解更多信息:您必须用标记包装标记,然后可以使用单元格单击事件发射器cellClick=cellClickHandler$event
有关更多信息,请参阅此文档:非常感谢!我正在寻找一个关于如何使用事件的示例!谢谢!我正在寻找一个关于如何使用事件的示例!
const buildObj = {
value: [jobObject.job],
type: 'cell',
startFrom: this.calcTimelineJobStart(startDate, index, width),
width,
color: this.colorCode(jobObject.job),
class:'hint'
};
<kendo-grid #grid (cellClick)="cellClickHandler($event)">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
<div class="w-100 timeline-cell-container">
<ng-container *ngFor="let item of getTimelineField(parentColumn.field, dataItem, true); let i=index">
<div class="timeline-cell position-absolute" [ngStyle]="getTimelineCellStyle(item)">
{{ item.value }}
</div>
</ng-container>
</div>
</ng-template>
<kendo-grid/>
public cellClickHandler({ sender, rowIndex, columnIndex, dataItem, isEdited }) {
// your code here
console.log(rowIndex, columnIndex)
}