Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Using Blazorise, how do I create a DataGrid that is not selectable?

$
0
0

I noticed that when I create a DataGrid, all the rows have this "table-row-selectable" class on it which allows users to click each row and highlight it in blue.

I'd rather eliminate this class/functionality, and it seems like there should be some option on the Data Grid somewhere.

AI suggested

  1. Selectable="false" - but there is not "Selectable" field
  2. SelectionMode="DataGridSelectionMode.None" - but "None" isn't an option, just single or mutltple.

I have managed to addRowSelectable="@((args) => false) which eliminates the selectable behavior then applied css of "cursor: default !important;" to eliminate the hover but this feels "hacky" and I'd love to hear if someone has a cleaner approach.

Sample Code

Here's a sample of the code I have:

<DataGrid @ref="DG"          TItem="Dto"          Data="Entities"          ReadData="OnDataGridReadAsync"          CurrentPage="CurrentPage"          TotalItems="TotalCount"          ShowPager="true"          PageSize="5"          RowSelectable="@((args) => false)"> <DataGridColumns><DataGridColumn Field="@nameof(Dto.Prop1)"                        Caption="@L["Header1"]"                        Sortable="true"><DisplayTemplate><strong><Span Class="uppercase">@context.Prop1</Span></strong></DisplayTemplate></DataGridColumn><DataGridColumn Field="@nameof(Dto.Prop2)"                        Caption="@L["Header2"]"                        Sortable="true"></DataGridColumn></DataGridColumns></DataGrid>

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>