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

How to format a column

1 Answer 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 27 Sep 2017, 12:31 PM

Hello!

I want to be able to change the value in a columns by calling this function MappingBoolToText.
If the passed argument is true I return "Ja" else return "Nej"

Function MappingBoolToText(value)
{
  return value ? 'Ja' : 'Nej';
}

I have tried to call this function from here

 

$("#grid").kendoGrid(
                    {
                        dataSource: this.datasource,
                        height: 550,
                        sortable: true,
                        columns: [
                            {
                                field: "Name",
                                title: "Namn"
                            },
                            {
                                field: "EmployeeNr",
                                title: "AD"
                            },
                            {
                                field: "RequireR1",
                                title: "Krav R1"
                            },
                            {
                                field: "RequireR2",
                                title: "Krav R2"
                            },
                            {
                                field: "SalaryR1",
                                title: "Lön R1"
                            },
                            {
                                field: "SalaryR2",
                                title: "Lön R2"
                            },
                            {
                                field: "IsGroupAdmin",
                                title: "Koncernadmin",

      fomat: MappingBoolToText(value)
                            },
                            {
                                field: "IsCompanyAdmin",
                                title: "Bolagadmin",
                                fomat: MappingBoolToText(value)
                            }
                        ]                                       
                    });   

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 29 Sep 2017, 07:21 AM
Hi Tony,

One possible solution is to use columns.template in order to customize the visualization of the data:



Regards,
Georgi
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Tony
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or