Dynamic creation of columns in kendo editable grid

2 posts, 1 answers
  1. Leya
    Leya avatar
    4 posts
    Member since:
    Feb 2015

    Posted 23 Feb 2015 Link to this post

    I have a model with ID and and array of values, I need each of the array value to be displayed in separate column in kendo grid and all this should be editable fields.

    public int Id { get; set; }
    public double[] List { get; set; }

    I have tried the following way however it display all values in one cell.

    @model IEnumerable<HoursModel>

    <div id="PlanningGrid">
              .Columns(columns =>
                 //// columns.AutoGenerate(true);
                  columns.Bound(c => c.Id).HeaderHtmlAttributes(new {@class = "grid-header-cell"}).HtmlAttributes(new {@class = "grid-row-cell planningoverview-grid-cell1"});

                  columns.Bound(p => p.List).ClientTemplate("#=generateTemplate(HoursList)#");
                  //// columns.Bound(m => m.EmployeeId).ClientTemplate("# for (var i=0;i<4;increment(i)) { console.log(i) } #");

    <script type="text/javascript">
        function generateTemplate(Wetness) {
            var template = "<ul>";
            for (var i = 0; i < Wetness.length; i++) {
                template = template + "<li>" + Wetness[i] + "</li>";
            return template + "</ul>";
  2. Answer
    Rosen avatar
    3253 posts

    Posted 25 Feb 2015 Link to this post

    Hello Leya,

    As we have discussed in the support ticket you have opened on the same matter, this is not supported. It may by workaround to a degree, having in mind that the number of columns cannot vary on per row basis. Also binding/editing on indexers is not supported. The attached project do illustrate a possible way to workaround this limitation however you should note that this scenario is unsupported and you should use this on your own risk. 


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top