Unplanned
Last Updated: 22 Feb 2024 06:57 by Michal
Federico
Created on: 08 Jan 2024 17:05
Category: ToolBar
Type: Bug Report
3
Changing the content of an adaptive Toolbar during runtime breaks the adaptiveness

When Adaptive = true, changing the collection of buttons seems to "break" the adaptive calculation. The Toolbar fails to determine what are the buttons to show in the main element and what are the buttons to show in the pop-up: https://blazorrepl.telerik.com/wSubOWlS08FLz7aZ54

===

ADMIN EDIT

For the time being, a possible workaround is to force the component to refresh when you change the buttons. For that purpose, you can dispose it and re-initialize it after some delay. Here is a runnable sample: https://blazorrepl.telerik.com/QIOFuCvS400o5tfL34.

2 comments
Michal
Posted on: 22 Feb 2024 06:57

Iam forgot the key part of the hack in previous post:
protected override async Task OnParametersSetAsync()
{

TOPBarID = Guid.NewGuid();
...
..
.
}

-- it helphing a lot, but not solving the problem completely. Maybe it help someone else.

Michal
Posted on: 22 Feb 2024 06:39

Hi,

 with this issue the toolbar is not usable in "real world" data driven apps.

Even fiddlering with "<TelerikToolBar Size="@ThemeConstants.ToolBar.Size.Large" Adaptive="true" @key="TOPBarID">" and key items, and VISIBLE at items level, doesnt solving the problem.

Admin tip with "delay" has another issue:

- lot of rerendering, and items are at the end reorganized in "random" possitions. Some of them are completely missing(which is the worst scenario)

 

 

Simillar setup with mixed static and dynamic items, with hotfix visible=....

the goal was to keep all collection items "rendered" butt hidden at component level = also nogo.

<TelerikToolBar Size="@ThemeConstants.ToolBar.Size.Large" Adaptive="true" @key="TOPBarID">
@if (/*NavStack.IsNavigating==false && */CurrentStackItem != null)
{

<ToolBarButton Visible=@(CurrentStackItem?.InWindow==false) OnClick="@(_=>{if(NavStack.PageState.Count > 1){ NavStack.PopPage(CurrentStackItem);}else{navMan.NavigateTo("prozam/wms/dash");}})" Icon="@FontIcon.ChevronLeft">Z</ToolBarButton>

<ToolBarButton Icon="@FontIcon.QrCodeScanner" Title="QR kod scan" OnClick="(_ => OZRowCmd(null, EnTypCmd.FotakQRPip))" ThemeColor=@ThemeConstants.Button.ThemeColor.Secondary>QR</ToolBarButton>
<ToolBarTemplateItem >
<span @onkeypress="@KeyHandlerNtb">
<TelerikTextBox Id="eFText" @ref=@eFText Placeholder="@CurrentStackItem?.Nazev1" MaxLength="100" DebounceDelay="0" @bind-Value=@CurrentStackItem.FText InputMode="search" Size="@Telerik.Blazor.ThemeConstants.TextBox.Size.Large"></TelerikTextBox>
</span>
</ToolBarTemplateItem>
<ToolBarButton Icon="@FontIcon.ArrowRotateCw" Title="refresh" OnClick="@(_ => gHL.Rebind())" OverflowText="Refresh">R</ToolBarButton>
<ToolBarButton Enabled=@(CurrentStackItem?.TypObj == "hl") Icon="@FontIcon.Plus" OnClick="@( _ => OZRowCmd(null, EnTypCmd.AkceNovy))" ThemeColor="@ThemeConstants.Button.ThemeColor.Dark" OverflowText="Nový záznam">N</ToolBarButton>
@if (CurrentStackItem?.TypPage == "B-Pick")
{

}
else
{
<ToolBarSeparator></ToolBarSeparator>
<ToolBarButton Enabled="@((CurrentStackItem?.TypObj != "hl"))" OnClick="@( _ => OZRowCmd(null, EnTypCmd.GridAkceDDoklad))" Icon="@FontIcon.Lock">Dokonči doklad</ToolBarButton>
<ToolBarButton OnClick="@( _ => OZRowCmd(null, EnTypCmd.GridAkceDInfo))" Icon="@FontIcon.InfoCircle">Info</ToolBarButton>

}
<ToolBarButton OnClick="@( _ => BarcodeReceived(CurrentStackItem.FText))" Icon="@FontIcon.BarcodeScanner" ThemeColor=@ThemeConstants.Button.ThemeColor.Secondary>Scan TEST</ToolBarButton>
}
</TelerikToolBar>

 

 

is there any other option like:

TelerikDialog.Refresh(); ?