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

Display members of a List<> in a single grid cell.

3 Answers 1630 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 02 Aug 2012, 01:11 PM
I am using the KendoUI library. I have a list containing the supported languages for my application. Something like this:

var LanguagesTest = new List<LanguagesOptions>
                                {
                                   LanguagesOptions.Tr,
                                   LanguagesOptions.Gr
                                };

What I want to accomplish is display somehow all the supported languages in the grid and display them as links. I tried to list them in a single grid cell like this:

columns: [
                  
                    {
                        field: "LanguagesTest",
                        width: 30
                    }
                ]

but I receive [object Object] in the cell. How can I display the members of a list in a single grid row ? Is that possible ? If not, is there a way to enumerate through the list and display a grid column for every List member ? Any other suggestions will be welcome, too. Here is the complete code for my grid. It gets json data from a controller:

 $("#grid").kendoGrid({
                dataSource: {
                    transport: {
                        read: {
                            url: "FranchiseListData",
                            dataType: "json"
                        }
                    },
                    pageSize: 10
                },
                height: 400,
                filterable: true,
                sortable: true,
                pageable: true,
                columns: [
                    {
                        template: '<a href="FranchiseDetails/#=Id#">#=FolderName#</a>',
                        field: "FolderName",
                        title: "Name",
                        width: 50
                    },
                    {
                        field: "Afk",
                        width: 30,
                        filterable: false
                    },
                    {
                        field: "Associate",
                        width: 50
                    },
                    {
                        field: "LanguagesTest",
                        width: 30
                    },
                    {
                        field: "Network",
                        width: 40
                    },
                    {
                        field: "LobbyTemplate",
                        title: "Lobby",
                        width: 20
                    },
                    {
                        field: "TableTemplate",
                        title: "Table",
                        width: 30
                    },
                    {
                        field: "InstallerExeName",
                        title: "Installer Exe Name",
                        width: 50
                    },
                    {
                        field: "ExeIconName",
                        title: "Exe Icon Name",
                        width: 50
                    }
                    ]
            });

Any help with some code examples or suggestions will be greatly appreciated. Thank You!

3 Answers, 1 is accepted

Sort by
0
Mic
Top achievements
Rank 1
answered on 16 Nov 2012, 07:42 AM
I am also interested in the answer, it would be very usefull.
0
Larissa
Top achievements
Rank 1
answered on 14 Mar 2016, 09:30 PM
I'm also interest in a solution for this situation.
0
Dimiter Topalov
Telerik team
answered on 17 Mar 2016, 04:25 PM
Hello Martin,

You can use the columns.template option to customize the display of a column's value:

columns: [ ... {
field: "numbers",
template: "#= numbers.join(', ') #"
} ],
dataSource: [
 { ...
, numbers: [ 1, 2, 3 ] }...);

i hope this helps.

Regards,
Dimiter Topalov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Mic
Top achievements
Rank 1
Larissa
Top achievements
Rank 1
Dimiter Topalov
Telerik team
Share this question
or