简体   繁体   English

如何覆盖剑道网格 CSS

[英]How to override Kendo grid CSS

I have following grid in vue.js. I wanna to change the grid header background and text color and hide the scrollbar according to these links:我在 vue.js 中有以下网格。我想根据这些链接更改网格 header 背景和文本颜色并隐藏滚动条:

https://docs.telerik.com/kendo-ui/knowledge-base/hide-scrollbar-when-not-needed https://docs.telerik.com/kendo-ui/knowledge-base/hide-scrollbar-when-not-needed

https://www.telerik.com/forums/styling-the-k-grid-header-(mvc) https://www.telerik.com/forums/styling-the-k-grid-header-(mvc)

But my custom css does'nt apply to grid header and content.但我的自定义 css 不适用于网格 header 和内容。 How do I change default kendo grid css?如何更改默认剑道网格 css?

<template>
    <div id="kgrid">
          <kendo-datasource ref="datasource1"
                            :transport-read-url="url + 'mylist/all'"
                            :page-size="'10'"
                            :schema-data="'data'"
                            :schema-total="'total'"
                            :transport-read-type="'POST'"
                            :transport-read-data-type="'json'"
                            :transport-read-content-type="'application/json'"
                            :transport-parameter-map="parameterMap"
                            :request-start="onBeforeSend"
                            :error="onError"
                            :server-paging="true"
                            :server-filtering="true">
          </kendo-datasource>
          <kendo-grid
                      :height="400"
                      :data-source-ref="'datasource1'"
                      :data-items="data"
          >
            <kendo-grid-column :field="'text'"
                               title="text">
            </kendo-grid-column>
          </kendo-grid>
        </div>
</template>
<script>
import {Grid, GridColumn} from '@progress/kendo-grid-vue-wrapper';
import {KendoDataSource} from '@progress/kendo-datasource-vue-wrapper';
export default {
  components: {
    'kendo-grid': Grid,
    'kendo-grid-column': GridColumn,
    'kendo-datasource': KendoDataSource
  },
}
</script>
<style scoped>
#kgrid .no-scrollbar .k-grid-header
{
    padding: 0 !important;
}

#kgrid .no-scrollbar .k-grid-content
{
    overflow-y: visible;
}
#kgrid .k-grid-header .k-header
{
    background-color: black;
    color: white
}
</style>

That's solved by removing "scoped" from style tag and adding ".important" to every style and removing ".no-scrollbar" class.这是通过从样式标签中删除“scoped”并将“.important”添加到每个样式并删除“.no-scrollbar”类来解决的。

put these styles in your global styles or remove the scoped from your style tag.将这些 styles 放入您的全局 styles 或从您的样式标签中删除范围。

And use for every style.important.并用于每种风格。重要的。

That should work.那应该有效。

Use the theme builder at Progess website and choose only the grid component.使用 Progess 网站上的主题生成器并仅选择网格组件。 when you're done download the files and copy them to you're styles folder.完成后,下载文件并将它们复制到您的 styles 文件夹中。

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

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