简体   繁体   English

在表格行之间添加间距

[英]Add Spacing between table rows

I developed a data grid but I'm having some problems with customizing it.我开发了一个数据网格,但在自定义它时遇到了一些问题。

Is there a way to remove the header bottom border and add a space between each row in the table?有没有办法删除标题底部边框并在表格中的每行之间添加一个空格?

DEMO 演示

code代码

<dx-data-grid style="margin-top:50px" class="table" [dataSource]="datas"
    [showColumnLines]="false" [showRowLines]="false" [columnAutoWidth]="true" [allowColumnResizing]="true">
    <dxo-header-filter [visible]="true"></dxo-header-filter>
    <dxi-column dataField="ID" dataType="text" caption="ID"></dxi-column>
    <dxi-column dataField="Name" dataType="text" caption="Name"></dxi-column>
</dx-data-grid>

要在行之间添加一些空间,请尝试在此引擎中更改 dx.light.css 文件中的 px 数

.dx-datagrid .dx-row > td {padding: 7px;}

for increasing the space between the rows, u have to increase the padding here:为了增加行之间的空间,你必须在这里增加padding

.table .dx-datagrid-rowsview .dx-row > td { 
   padding: 7px 0;
}

this seems like it would only increase the size of the line, like u noticed but it's also increases the space.这似乎只会增加线条的大小,就像你注意到的那样,但它也会增加空间。 Currently it looks like its not, because of the shadow which you set here:目前它看起来不像,因为你在这里设置的阴影:

.table .dx-datagrid-rowsview .dx-row {
   ..
   box-shadow: 0px 3px 20px #BCBCCB47;
}

Giving the td elemente padding, is maybe the only way to increase your spacing.td elemente 填充,可能是增加间距的唯一方法。 You have to set the shadow somewhere else.你必须在其他地方设置阴影。

To remove the border at the top, try this:要删除顶部的边框,请尝试以下操作:

.dx-datagrid-headers + .dx-datagrid-rowsview {
   border-top: 0;
}

You can use the ::ng-deep pseudo-class selector您可以使用::ng-deep伪类选择器

::ng-deep manipulations are actually deprecated , BUT it stills working for now. ::ng-deep操作实际上已弃用它现在仍然有效。

In Fact ::ng-deep is often necessary when you didn't write the component and don't have access to its source so feel free to use it for now.事实上,当您没有编写组件并且无法访问其源代码时, ::ng-deep通常是必需的,因此现在可以随意使用它。

You can use border-bottom: 4px solid #FFFFFF;您可以使用border-bottom: 4px solid #FFFFFF; at .dx-data-row to add space between the table rows在 .dx-data-row 中添加表格行之间的空间

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

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