This is a migrated thread and some comments may be shown as answers.

Multiple optional field for single column in kendo grid columnDefinition.

2 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rajesh
Top achievements
Rank 1
Rajesh asked on 04 Oct 2019, 12:35 PM

Hi,

 

I am facing issue in kendo grid.

I want to pass multiple optional text as field for single column in kendo grid column definition.

e.g. - Having following JSON and column definition

[

{ 'name': 'Tom', 'play': 'Football'}   // here name property is available in both object, but play and study not exist in both.

{'name': 'Jack', 'study': 'Vue'}

]

Column Definition - 

columnsDefinitions: [{
        field: 'name',
        title: 'First Name'      
      },

    {
        field: 'study' OR 'play'  // how to pass optional multiple property
        title: 'Occupations'      
      } ]

If I make another object in column definition then three columns are created.

But I am expecting only two column - First Name and Occupations (contains - play and study)

Thanks!

2 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 08 Oct 2019, 07:34 AM

Hi Rajesh,

The required could be achieved by defining a Cell template for a given column. Here is some more information on the different ways of configuring a Cell template in the Kendo native Vue Grid:

https://www.telerik.com/kendo-vue-ui/components/grid-native/custom-rendering/custom-cells/

Here you will find a small StackBlitz sample implementing a conditional column as per the sample data, that you have sent:

https://stackblitz.com/edit/onczsc?file=index.html

Regards,
Veselin Tsvetanov
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Rajesh
Top achievements
Rank 1
answered on 08 Oct 2019, 09:00 AM
Thank you very much Veselin.
Tags
Grid
Asked by
Rajesh
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Rajesh
Top achievements
Rank 1
Share this question
or