简体   繁体   English

Kendo ui网格标题中垂直90度的网格列名称

[英]kendo ui grid column names at 90 degree vertical in grid header

I DO NOT KNOW where to PUT THE CSS RELATED CODE. 我不知道在哪里放置CSS相关代码。 Please don't respond with CSS settings because I would not know where to put it in my asp.net mvc4 solution project code. 请不要以CSS设置作为响应,因为我不知道将其放在asp.net mvc4解决方案项目代码中的位置。

I am new to Kendo Grid so I do not know how to apply header templates css style and where to put this type of code in relation to the grid. 我是Kendo Grid的新手,所以我不知道如何应用标题模板css样式以及将这种类型的代码放在网格上的位置。

Currently I have a grid where column names are spelled out and grid is running out of browser. 目前,我有一个网格,其中列名已被拼写出来,并且网格浏览器已用完。 Is there a way, I could display the grid column header names as vertical rotated at 90 degrees? 有没有一种方法,我可以将网格列标题名称显示为垂直旋转90度?

Here is what my grid looks like. 这是我的网格的样子。

        @(Html.Kendo().Grid<TimberBeamCalculator.Models.TimberGrades>()
            .Name("TimberGradeGrid")
            .DataSource(ds => ds
                            .Ajax()
                            .Read(r => r.Action("TimberData_Read", "Calculator"))   
            )
            .Columns(c=> 
                    {
                        c.Bound(t => t.TimberGrade).Width(10);
                        c.Bound(t => t.BendingParallelToGrain).Width(20);
                        c.Bound(t => t.CompPerpendicularToGrain).Width(10);
                        c.Bound(t => t.ShearParallelToGrain).Width(20);
                        c.Bound(t => t.ModulusOfElasticityMean).Width(10);
                        c.Bound(t => t.ModulusOfElasticityMin).Width(20);
                        c.Bound(t => t.SoftWood).Width(10);
                    }
            )
            .Selectable(s => s.Mode(GridSelectionMode.Single))
            .Events(e => e.Change("OnChangeDivTimberGradeGrid"))
        )

The same question is discussed here . 同样的问题是讨论在这里 You can do it by adding the magic CSS like so: 您可以通过添加魔术CSS来做到这一点,如下所示:

#grid .k-grid-header {
  padding-left: 17px;
}

#grid .k-grid-header tr:first{
  height: 150px;
}

#grid .k-grid-header .k-header{
  -webkit-transform: rotate(-90deg);
  -moz-transform: rotate(-90deg);
  -ms-transform: rotate(-90deg);
  -o-transform: rotate(-90deg);
  height: 150px !important;
  width: 130px !important;
}

Here is a JsBin . 这是一个JsBin

How about just adding a horizontal scroll bar to your table? 仅向表中添加水平滚动条怎么样? Kendo produces a wrapper .k-grid div tag around it's table therefore in your stylesheet add the below. Kendo在table周围产生一个包装器.k-grid div tag ,因此在样式表中添加以下内容。

.k-grid{margin-top:auto;overflow:auto;}
.k-grid table td{white-space:nowrap;}

Vertical Text - not working 竖排文字-不起作用

Taken from this site - http://scottgale.com/css-vertical-text/2010/03/01 取自该网站-http: //scottgale.com/css-vertical-text/2010/03/01

Vertically aligns text but height of column does not adjust. 垂直对齐文本,但列高度不调整。

c.Bound(t => t.TimerGrade)
 .HeaderHtmlAttributes(new { @class = "vertical-text" });

.vertical-text
{
    writing-mode:tb-rl;
    -webkit-transform:rotate(90deg);
    -moz-transform:rotate(90deg);
    -o-transform: rotate(90deg);
    white-space:nowrap;
    display:block;
    bottom:0;
    width:20px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM