Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to span column header over 2 columns with Kendo UI Grid Wrapper?

Tags:

kendo-ui

Using the MVC Wrapper for Kendo Grid, How can I have the column header span 2 columns?

I have 4 columns and want a header on the 1st and 3rd column spaning col1 and col 2, and the one on col 3 spaning col 3 an 4.

when I do it with

.HeaderHtmlAttributes(new { Colspan = 2 })

it works, but there are always 4 headers, not only 2...

like image 388
Daniel Avatar asked Dec 27 '22 13:12

Daniel


1 Answers

You can add a.HeaderHtmlAttributes(new { style= "display:none;" }) to the following column :

@(Html.Kendo().Grid(Model.List)
    .Name("grid")
    .Columns(c => { 
        c.Bound(e => e.ID); 
        c.Bound(e => e.Nom).HeaderHtmlAttributes(new { colspan = 2 }); 
        c.Bound(e => e.Nb).HeaderHtmlAttributes(new { style= "display:none;" }); 
    })
)
like image 141
Samuel Caillerie Avatar answered May 09 '23 17:05

Samuel Caillerie