从剑道网格获取数据项,使用角度中的自定义按钮



我正在尝试将数据项从剑道网格传递到 Angular 6 上的组件。设置如下。

<kendo-grid
[data]="view | async"
[height]="533"
(dataStateChange)="onStateChange($event)"
(edit)="editHandler($event)" (remove)="removeHandler($event)"
(add)="addHandler($event)"
>
<ng-template kendoGridToolbarTemplate>
<button kendoGridAddCommand>Add new</button>
</ng-template>
<kendo-grid-column field="Id" title="ID"></kendo-grid-column>
<kendo-grid-column field="Name" title="Company Name"></kendo-grid-column>
<kendo-grid-column field="BillingInfo.BillingGroup" title="Group"></kendo-grid-column>
<kendo-grid-column field="DefaultProcessingLocation" title="Default Location"></kendo-grid-column>
<kendo-grid-column field="BillingInfo.BillingCode" title="Code"></kendo-grid-column>
<kendo-grid-command-column title="Action" width="300">
<ng-template kendoGridCellTemplate let-dataItem>
<button kendoGridEditCommand [primary]="true">Edit</button>
<button kendoGridRemoveCommand>Delete</button>
<button (click)="getCustomerJobs(dataItem)">Jobs</button>
</ng-template>
</kendo-grid-command-column>
</kendo-grid>
<app-edit-customer [model]="editDataItem" [isNew]="isNew"
(save)="saveHandler($event)"
(cancel)="cancelHandler()">
</app-edit-customer>

当我单击编辑或删除数据项时,我会看到数据项。但是,当我单击"作业"时,getCustomerJobs将数据项返回为"未定义"。

提前感谢您的帮助。

我相信你很接近。问题是剑道网格列上的标记。

更改此(剑道网格命令列(...

<kendo-grid-command-column title="Action" width="300">
<ng-template kendoGridCellTemplate let-dataItem>
<button kendoGridEditCommand [primary]="true">Edit</button>
<button kendoGridRemoveCommand>Delete</button>
<button (click)="getCustomerJobs(dataItem)">Jobs</button>
</ng-template>
</kendo-grid-command-column>

对此(剑道网格列(..

<kendo-grid-column title="Action" width="300">
<ng-template kendoGridCellTemplate let-dataItem>
<button kendoGridEditCommand [primary]="true">Edit</button>
<button kendoGridRemoveCommand>Delete</button>
<button (click)="getCustomerJobs(dataItem)">Jobs</button>
</ng-template>
</kendo-grid-column>

最新更新