前几天,我问了一个有关删除选定行上的悬停效果的问题,并得到了正确的答案,现在我遇到了一个问题,因为我正在使用kendo bootstrap css,现在删除选定行上的悬停效果现在不起作用,并且我尝试了几种不同的方法来更改悬停效果,以保持与选择的k状态相同的颜色,但没有一个起作用。



$("#grid").kendoGrid({
  columns: [{
      field: "name"
    },
    {
      field: "age"
    }
  ],
  dataSource: [{
      name: "Jane Doe",
      age: 30
    },
    {
      name: "John Doe",
      age: 33
    }
  ],
  selectable: "row"
});

.k-grid .k-state-selected {
  background: #ec971f;
}

.k-grid .k-state-selected:hover {
  background: #ec971f!important;
  color: #000;
}

.k-grid .table-hover tbody tr:hover td,
.table-hover tbody tr:hover th {
  background: #ec971f !important;
}

.k-grid .table-hover tbody .k-state-selected:hover {
  background: #ec971f !important;
}

<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.3.1017/styles/kendo.common-bootstrap.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.3.1017/styles/kendo.bootstrap.min.css" />

<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.3.1023/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.3.1023/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.3.1023/js/kendo.all.min.js"></script>

<div id="grid"></div>

最佳答案

$("#grid").kendoGrid({
  columns: [{
      field: "name"
    },
    {
      field: "age"
    }
  ],
  dataSource: [{
      name: "Jane Doe",
      age: 30
    },
    {
      name: "John Doe",
      age: 33
    },
    {
      name: "Jane Doe",
      age: 30
    },
    {
      name: "Jane Doe",
      age: 30
    },
  ],
  selectable: "row"
});

.k-grid tr:hover {
    background-color: transparent !important;
}

.k-grid tr.k-alt:hover {
  background-color: #f5f5f5 !important;
}

<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.3.1017/styles/kendo.common-bootstrap.min.css" />
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.3.1017/styles/kendo.bootstrap.min.css" />

<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.3.1023/js/angular.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.3.1023/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2019.3.1023/js/kendo.all.min.js"></script>

<div id="grid"></div>

10-07 14:09