Skip to content

Commit b1ad1e3

Browse files
authored
QuickGrid empty rows and border styling (#34214)
1 parent 78bbce4 commit b1ad1e3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

aspnetcore/blazor/components/quickgrid.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,33 @@ To provide a UI for pagination, add a [`Paginator` component](xref:Microsoft.Asp
138138

139139
In the running app, page through the items using a rendered `Paginator` component.
140140

141+
QuickGrid renders additional empty rows to fill in the final page of data when used with a `Paginator` component. In .NET 9 or later, empty data cells (`<td></td>`) are added to the empty rows. The empty rows are intended to facilitate rendering the QuickGrid with stable row height and styling across all pages. You can apply styles to the rows using [CSS isolation](xref:blazor/components/css-isolation) by wrapping the `QuickGrid` component in a wrapper element, such as a `<div>`, and applying a row style with `::deep` [pseudo-elements](https://developer.mozilla.org/docs/Web/CSS/Pseudo-elements):
142+
143+
```css
144+
::deep tr {
145+
height: 2em;
146+
}
147+
```
148+
149+
To hide the empty row data cells rendered by the QuickGrid, use CSS styling. In the following isolated CSS styles:
150+
151+
* Row cells populated with data are displayed.
152+
* Empty row data cells aren't displayed, which avoids empty row cell borders from rendering per Bootstrap styling.
153+
154+
`{COMPONENT}.razor.css`:
155+
156+
```css
157+
::deep tr:has(> td:not(:empty)) > td {
158+
display: table-cell;
159+
}
160+
161+
::deep td:empty {
162+
display: none;
163+
}
164+
```
165+
166+
For more information on using `::deep` [pseudo-elements](https://developer.mozilla.org/docs/Web/CSS/Pseudo-elements) with CSS isolation, see <xref:blazor/components/css-isolation#child-component-support>.
167+
141168
## Custom attributes and styles
142169

143170
QuickGrid also supports passing custom attributes and style classes (<xref:Microsoft.AspNetCore.Components.QuickGrid.QuickGrid%601.Class%2A>) to the rendered table element:

0 commit comments

Comments
 (0)