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

concat collection into column

1 Answer 1052 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
AGISDev
Top achievements
Rank 1
AGISDev asked on 07 Feb 2019, 04:20 PM

take this data

{
"Firstname": "Jim",
"Lastname": "Smith",
"Birthday": "08/29/1979",
"Likes": [
    { Likes: [ { id: 1, description: "Baseball", rank: 1 }, {id: 2, description: "music", rank: 3 }, { id: 3, description: "Surfing the web", rank: 2}]

} }]
}

First 3 fields bind directly to the grid in 3 columns.

I would like to concatenate the collection of Likes, and display in the final column.

Something like this

<td>Jim</td><td>Smith</td><td>08/29/1979</td><td>Baseball; music; Surfing the web;</td>

I've been unable to find anything like this.

 

 

 

1 Answer, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 08 Feb 2019, 12:51 PM
Hello Charles,

You can utilize the Grid's Cell template to provide any desired custom content based (or not) on the data item, associated with each row, for example:

https://stackblitz.com/edit/angular-hytbhp?file=app/app.component.ts

You can also create a HTML table for the Likes (or create any other HTML element(s) to display the content in the desired manner):

https://stackblitz.com/edit/angular-hytbhp-dfrulf?file=app/app.component.ts

I hope this helps.

On a side note, it is also worth mentioning that when the data contains dates, it needs to be mapped such that all date fields represent valid JavaScript Date objects so that the built-in sorting, filtering, formatting and editing functionalities can work as expected:

https://www.telerik.com/kendo-angular-ui/components/grid/data-binding/#toc-getting-started

https://www.telerik.com/kendo-angular-ui/components/grid/troubleshooting/#toc-handling-of-dates

Regards,
Dimiter Topalov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
AGISDev
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Share this question
or