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

How can I prevent clicking on the row hiding/showing the DetailRow?

$
0
0

I only want the DetailRow to show if Billable is checked or Preview button has been pressed.

However despite the @ShowDetailRow returning "true" (Console.WriteLine(result)) in the dotnet watch output the Detail row is not showing depending on if I have clicked on the row or not.

I have tried adding PreventRowClick to all columns, but the the DetailRowTrigger does not even get called (even though I can Switch the billable and Toggle the Preview and the UI updates)

Basically how can I only allow the DetailRow to become visible based on values in the row Data @VisitDocuments

DataGrid TItem="VisitDocumentDTO"          Data="@VisitDocuments"          @ref="dataGridRef"          RowStyling="@OnRowStyling"          Responsive          Resizable          ResizeMode="TableResizeMode.Header"          SortMode="DataGridSortMode.Single"          ShowPager          ShowPageSizes          ShowGrouping          CustomFilter="@OnCustomFilter"          DetailRowStartsVisible="true"          DetailRowTrigger=@ShowDetailRow          PagerPosition="DataGridPagerPosition.Bottom"          PagerOptions="new(){ ButtonSize=Size.Small }"><DataGridColumns><DataGridCommandColumn PreventRowClick Caption="Billable" /><DataGridCheckColumn Editable Field="@nameof(VisitDocumentDTO.BillingStatus)" Caption="Bill" ><DisplayTemplate>                @if (context.BillingStatus)                {<span class="badge bg-success">Billed: @(context.BillingCode?.Count > 0 ? string.Join(", ", context.BillingCode) : "None")</span>                }                else                {<span class="badge bg-warning">None</span>                }<Switch TValue="bool" Checked="@context.BillingStatus" CheckedChanged="@( (va) => context.BillingStatus = va)">                    Billable</Switch></DisplayTemplate></DataGridCheckColumn><DataGridDateColumn PreventRowClick Field="@nameof(VisitDocumentDTO.ServiceDtm)" Caption="Service Date" Editable Grouping Groupable DisplayFormat="{0:ddd - dd/MMM/yy}" /><DataGridDateColumn PreventRowClick Field="@nameof(VisitDocumentDTO.ServiceDtm)" Caption="Time" Editable Grouping Groupable DisplayFormat="{0:hh:mm}" /><DataGridColumn PreventRowClick Field="@nameof(VisitDocumentDTO.DocumentName)" Caption="Document Name" Editable /><DataGridColumn PreventRowClick Field="@nameof(VisitDocumentDTO.ProviderDisplayName)" Caption="Provider" Editable /><DataGridColumn PreventRowClick Field="@nameof(VisitDocumentDTO.ProviderOccupationCode)" Caption="Occupation" Editable /><DataGridColumn PreventRowClick Field="@nameof(VisitDocumentDTO.DocumentText)" Caption="Codable Text" Width="500px"><DisplayTemplate><MemoEdit Style="font-size: 12px;" Rows="5" Text="@context.DocumentText" ReadOnly="true" /></DisplayTemplate></DataGridColumn><DataGridColumn PreventRowClick TItem=VisitDocumentDTO Caption="Preview"><DisplayTemplate><Button Color="@(GetPreviewToggleState(context) ? Color.Primary : Color.Light)"                         @onclick="() => TogglePreviewState(context)"><Icon Name="@(GetPreviewToggleState(context) ? IconName.Eye : IconName.EyeSlash)"/></Button></DisplayTemplate></DataGridColumn></DataGridColumns><DetailRowTemplate>        @if (context.BillingStatus)        {<Fields style="margin-bottom: 10px; background-color: #a8b2bd; margin: 10px; border-radius: 5px; vertical-align: top;"><Field ColumnSize="ColumnSize.Is4.OnDesktop"><FieldLabel>Attendance Items</FieldLabel>                        @foreach (var option in attendanceOptions)                        {<Check TValue="bool" Checked="@(context.BillingCode != null && context.BillingCode.Contains(option))" CheckedChanged="() => HandleSelectionChange(context, option)">                                @option</Check>                        }<FieldHelp>Select applicable attendance billing codes</FieldHelp></Field><Field ColumnSize="ColumnSize.Is4.OnDesktop"><FieldLabel>Treatment Items</FieldLabel>                        @foreach (var option in treatmentOptions)                        {<Check TValue="bool" Checked="@(context.BillingCode != null && context.BillingCode.Contains(option))" CheckedChanged="() => HandleSelectionChange(context, option)">                                @option</Check>                        }<FieldHelp>Select applicable treatment code</FieldHelp></Field><Field ColumnSize="ColumnSize.Is4.OnDesktop"><FieldLabel>Miscellaneous</FieldLabel>                        @foreach (var option in miscellaneousOptions)                        {<Check TValue="bool" Checked="@(context.BillingCode != null && context.BillingCode.Contains(option))" CheckedChanged="() => HandleSelectionChange(context, option)">                                @option</Check>                        }<FieldHelp>Select applicable Miscellaneous code</FieldHelp></Field></Fields>        }        @if (GetPreviewToggleState(context))        {<Fields style="margin-bottom: 10px; background-color: #a8b2bd; margin: 10px; border-radius: 5px;"><Field Horizontal="false"><FieldLabel>Preview <small class="text-muted">(click to close)</small></FieldLabel><div @onclick="() => TogglePreviewState(context)"                         style="cursor: pointer; border: 1px dashed #ccc; border-radius: 4px; padding: 5px; background-color: #f8f9fa;"><pre style="white-space: pre-wrap; margin: 0; background: transparent; border: none;">                            @context.DocumentText</pre></div></Field></Fields>        }</DetailRowTemplate></DataGrid>

Viewing all articles
Browse latest Browse all 4839

Trending Articles