Last Updated: 08 Jul 2019 08:08 by ADMIN
Created on: 02 Jul 2019 05:15
Category: Grid
Type: Feature Request
Allow to specify a custom template reference at column level

Hi There,

We started using Kendo Grid extensively. We came across below requirement and confirmed with your support team that the feature is currently not available. We think this would really allow users customise their display. 

Requirement analysis:

We would be using a common wrapper class across the org. 

We will be displaying list of records from the DB, at times, there are columns which contains a JSON,  we need to use a custom template to display the JSON. I understand I can go with an if condition in the template html of grid, but, that would lead me to end up having N number of conditions since we do not have a limited such use cases, each such instance would need to be rendered with different template.

The same is the case with row editing as well, for instance, for columns which accepts a description, we want to show a custom popover which would allow the user to specify the data in the way the customer wants (rich text with lot of customisation)


At a high level if we nail down into steps of the behaviour

1) Columns definition will come as a JSON which would also contain a template reference for any of the columns. 

 To elaborate more, If firstName and lastName are the columns at the DB level but for grid view I want to show them as a single column.

2) The JSON we are constructing will have a type attribute which would indicate me on whether to use a user defined template or regular one.

3) Corresponding data will be a JSON with possible keys required for the template.

1 comment
Dimiter Topalov
Posted on: 08 Jul 2019 08:08
Hi Srinivas,

Thank you for this suggestion. I discussed it with our leading Grid developers,  but due to the specifics of the Angular framework, and the limitations associated with creating template refs in different context, with different injectors, etc., I am afraid we will not be able to provide such a built-in Grid functionality.

We explored a similar opportunity in the past, when we were designing the built-in editing functionality and the Grid edit templates, and even had a conversation with the Angular team in an issue, logged to their GitHub repo:

For this, and other similar and related reasons, the Grid implementation necessitates all Cell and other Grid templates to be defined within the Grid template - this way the correct context and injectors are received, and the templates are working as expected.

If you have an idea how to achieve this with Angular in general (for example a regular HTML table generated with a *ngIf loop over some collection of items that have templates, passed from the outside), please let us know and send us a runnable demo that demonstrates how the functionality, described in this feature request can be achieved with a regular table, and we will do our best to integrate this or similar approach in the Kendo UI for Angular Grid.

Thank you in advance.

Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.