【问题标题】:How to customize the background color of selected of a Kendo UI Grid row如何自定义选定的 Kendo UI Grid 行的背景颜色
【发布时间】:2014-03-18 09:01:22
【问题描述】:

我是剑道 UI 新手。在我的 Asp.Net MVC 应用程序中,我使用 Kendo UI Grid 小部件并配置该 Grid,以便用户可以选择一个 Grid 行,例如:

$("#gridSurvey").kendoGrid({
                dataSource: {
                    type: "json",
                    transport: {
                        read: {
                            url: "/MyController/GetItemList",  

                            ...
                selectable: "row",
                change: function(e)
                {
                    var entityGrid = $("#gridItems").data("kendoGrid");
                    _selectedItem = entityGrid.dataItem(entityGrid.select());

                },
                ...

默认情况下,当用户单击某一行时,所选 Grid 行的所选行会以某种内置颜色突出显示。如何自定义/将所选行的背景颜色更改为透明或其他颜色?我更喜欢透明的背景颜色。请帮忙。提前谢谢你。

【问题讨论】:

    标签: kendo-ui kendo-grid


    【解决方案1】:
    .k-grid .k-state-selected { background: blue; }
    

    【讨论】:

    • 感谢您的回答。它确实对我有帮助。
    • 对于选定的行悬停颜色,使用这个.k-grid table tr:hover td
    • 封装:ViewEncapsulation.None,我错过了这一步来反映。请查看stackoverflow.com/questions/45547163/…
    【解决方案2】:
    .k-grid td.k-state-selected:hover, .k-grid tr:hover {
        color: #fff;
        background-color: darkslategray;
    }
    

    【讨论】:

    • 使用 .NET Core MVC 项目中的当前 Telerik UI,这个对我有用。接受的答案没有。
    猜你喜欢
    • 2018-04-01
    • 2021-07-20
    • 2021-03-25
    • 2016-12-10
    • 1970-01-01
    • 2016-05-06
    • 2010-09-21
    • 1970-01-01
    • 2015-01-16
    相关资源
    最近更新 更多