kendo ui grid column template not being applied

kpg

Followed getting started documentation to setup a basic grid. I added a column template to bold the first column but it is not being applied. I tried the code in Dojo and it works. Triple checked the syntax, gird is displayed fine with all the data but no bold is applied.

Inspection of the html in chrome shown no style applied to the table data.

This has to be something really simple I'm overlooking...

here is the code:

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Client</title>
  
<!-- Common Kendo UI CSS for web widgets and widgets for data visualization. -->
    <link href="../css/kendo/kendo.common.min.css" rel="stylesheet" />
    <!-- (Optional) RTL CSS for Kendo UI widgets for the web. Include only in right-to-left applications. -->
    <%--<link href="../css/kendo/kendo.rtl.min.css" rel="stylesheet" type="text/css" />--%>
    <!-- Default Kendo UI theme CSS for web widgets and widgets for data visualization. -->
    <link href="../css/kendo/kendo.default.min.css" rel="stylesheet" />
    <!-- (Optional) Kendo UI Hybrid CSS. Include only if you will use the mobile devices features. -->
    <link href="../css/kendo/kendo.default.mobile.min.css" rel="stylesheet" type="text/css" />
    <!-- Kendo UI combined JavaScript -->
    <script src="../js/kendo/kendo.all.min.js"></script>  
  
  <script>

        var people = [
               { firstName: "John",
                   lastName: "Smith",
                   email: "[email protected]"
               },
               { firstName: "Jane",
                   lastName: "Smith",
                   email: "[email protected]"
               },
               { firstName: "Josh",
                   lastName: "Davis",
                   email: "[email protected]"
               },
               { firstName: "Cindy",
                   lastName: "Jones",
                   email: "[email protected]"
               }
         ];


        $("#client_grid").kendoGrid({
            autoBind: false,
            selectable: true,
            columns: [{
                field: "firstName",
                title: "First Name",
                template: "<strong>#: firstName # </strong>"
            },
            {
                field: "lastName",
                title: "Last Name",
            },
            {
                field: "email",
                title: "Email",
            }]
        });


        $("#client_grid").kendoGrid({
            dataSource: people
        });

                      
    </script>


</head>
<body>

<div id="client_grid" />


</body>
</html>

The Dread Pirate Stephen

Well, based on the code you provided, you are initializing the grid twice:

One:

$("#client_grid").kendoGrid({
        autoBind: false,
        selectable: true,
        columns: [{
            field: "firstName",
            title: "First Name",
            template: "<strong>#: firstName # </strong>"
        },
        {
            field: "lastName",
            title: "Last Name",
        },
        {
            field: "email",
            title: "Email",
        }]
    });

Two:

$("#client_grid").kendoGrid({
        dataSource: people
    });

And the second one is blowing away your config of the first(including the template).

Just do this instead:

$("#client_grid").kendoGrid({
        dataSource: people,
        autoBind: false,
        selectable: true,
        columns: [{
            field: "firstName",
            title: "First Name",
            template: "<strong>#: firstName # </strong>"
        },
        {
            field: "lastName",
            title: "Last Name",
        },
        {
            field: "email",
            title: "Email",
        }]
    });
// Because autobind is false, you have to trigger the fetch somehow...
$("#client_grid").getKendoGrid().dataSource.read();

Demo: http://dojo.telerik.com/@Stephen/UPuga

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Kendo UI grid template column

Kendo UI MVC Grid - DataSource Interfering With Column Template

kendo-ui grid column template function field-name

Custom template in kendo-ui grid column with inconsistent data type

Kendo UI Grid Template error - invalid template

Specifying Javascript in a header template for a column on my Kendo MVC grid just renders the Javascript (Kendo UI MVC)

Kendo grid column template for column with values

Kendo UI Grid Detail Template in Declarative Initialization

Kendo UI Grid - Client Template: Escaping # sign

Kendo ui grid client template "Id is not defined"

Kendo UI Mvc Grid Title template

Kendo UI Grid Row Template Command

kendo ui grid angular 2 footer template

I want to display the applied filter criteria on the Kendo UI Grid

Call function in kendo grid column template

Kendo Grid - Dynamic Column and Custom Template

Adding Calculations in Kendo Grid Column Template

Kendo UI Grid Filtering column with multiple values

Typescript Kendo UI grid column type error

Kendo UI Grid Checkbox Column Field Not Defined

Kendo UI for Angular custom sorting grid column

jquery kendo ui: Grid with custom autocomplete column

Kendo-UI Hybrid UI Grid Edit Template

Kendo UI: Conditionally preventing a Tooltip from being displayed on a Grid cell

How to customize column template when kendo grid column is auto generated?

How to get column total of Kendo-UI grid column (calculated)

How to catch applied column filter in angular ui-grid

How to use a template when adding a new row to kendo ui grid?

Kendo UI grid - how to display an image in ng-template