Detail Template Events

2019-09-15 15:43发布

问题:

Does Kendo support grid events when users interact with Detail Templates. Specifically, I am looking to load the data for the detail template when a user opens an individual row.

The best solution I have is to place a click event handler on the grid and verify the target corresponds to the button that opens/closes the detail template. However, this seems complicated and error-prone if the kendo representation changes.

回答1:

You can wrap the detail template in your custom component and use the Angular lifecycle hooks to fetch your content. It should be something like:

<template kendoDetailTemplate let-dataItem>
  <data-fetch-component *ngIf="dataItem.Category">
    <header>{{dataItem.Category?.CategoryName}}</header>
    <article>{{dataItem.Category?.Description}}</article>
  </data-fetch-component>
</template>