Telerik Forums
UI for Blazor Forum
0 answers
123 views

Scenario:

Put a visual Linear Gauge into a GridColumn so to show a visual perspective of a count instead of a number.

Issue:

On first page render the Grid to the page, the TelerikLinearGauge shows.   If I exit to another page and then come back to the page, the TelerikLinearGauge will not render, and the column is now blank.  

How to Refresh:

There must be some trick to having the image of the gauge re-render on subsequent refreshes of the page.  I hate guessing and think this is a typical scenario that should be documented on your site.  Right?

Preferred Approach:

The Linear Gauge will render and refresh just like all the other columns without custom workarounds and/or techniques.

 

Telerik.Blazor.Components.TelerikLinearGauge LinearGaugeRef { get; set; }

Code:

 <GridColumn Field="@nameof(PackageRequest.ViewCount)" Title="Views" Width="40px" Visible="false">
            <Template>
                @{
                    var item = context as PackageRequest;
                    @if (item.ViewCount > 0)
                    {
                        <TelerikLinearGauge>
                            <LinearGaugeScales>
                                <LinearGaugeScale Min="0" Max="@TotalViewCount" Vertical="false">
                                    <LinearGaugeScaleMinorTicks Visible="false"></LinearGaugeScaleMinorTicks>
                                </LinearGaugeScale>
                            </LinearGaugeScales>
                            <LinearGaugePointers>
                                <LinearGaugePointer Value="@item.ViewCount" />
                            </LinearGaugePointers>
                        </TelerikLinearGauge>
                    }
                }
            </Template>
        </GridColumn>
Jerdobi
Top achievements
Rank 1
Iron
Iron
 updated question on 22 Nov 2022
1 answer
179 views
If I use anything other than pixels (or if I don't set it at all) I get an error. My app will be running on a cell phone or tablet which could be in portrait or landscape orientation so setting the size in pixels doesn't work very well.
Dimo
Telerik team
 answered on 21 Nov 2022
0 answers
198 views
Hi Telerik,

I'm excited with the FileManager component. Do this component support with the Amazon S3 bucket folder?
Could we have some demo project with this feature, and it will be awesome.
David
Top achievements
Rank 1
 asked on 21 Nov 2022
0 answers
259 views
I have a wizard with 3 steps and I want to persist the content because I don't want to lose the content's (components) data while navigating between steps.
Luyeye
Top achievements
Rank 1
 asked on 21 Nov 2022
0 answers
168 views

Blazor server doesn't work at all when AdBlocker is on.

 

Any workaround?

 

 

Ilan
Top achievements
Rank 1
Bronze
Iron
Veteran
 asked on 20 Nov 2022
1 answer
161 views

Good Morning,

I vave this code. I try to create a FluentValdation in TelerikForm, code builts good.  When i submit empty form, validations are good(), but the form doesn't show the errors.


<TelerikForm Model="@TriggerDetail" Columns="1" ColumnSpacing="25px" OnValidSubmit="@HandleValidSubmit" EditContext="@EditContext">
    <FormValidation>
        <FluentValidationValidator Validator="@Validator"></FluentValidationValidator>
    </FormValidation>    
    <FormItems>
        <FormGroup LabelText="General Information" Columns="2" ColumnSpacing="15px">
            <FormItem Field="@nameof(TriggerDetailModel.Name)" LabelText="@Localizer["JobTrigger_Name"]" Enabled="@Enabled"></FormItem>
            <ValidationMessage For="@(() => TriggerDetail.Name)" />
            <FormItem Field="@nameof(TriggerDetailModel.Group)" LabelText="@Localizer["JobTrigger_Group"]" Enabled="@Enabled">
                <Template>
                    <label class="k-label k-form-label">@Localizer["JobTrigger_Group"]</label>
                    <TelerikAutoComplete Data="@ExistingTriggerGroups" @bind-Value="@TriggerDetail.Group" ClearButton="true" Enabled="@Enabled" />
                </Template>
            </FormItem>
			<ValidationMessage For="@(() => TriggerDetail.Group)" />
		</FormGroup>
	</FormItems>
	<FormButtons>       
            <TelerikButton Icon="caret-alt-to-left" OnClick="@BackStep" ThemeColor="@(ThemeConstants.Button.ThemeColor.Error)">@Localizer["Back"]</TelerikButton>
            <TelerikButton ButtonType="ButtonType.Submit" Icon="caret-alt-to-right" ThemeColor="@(ThemeConstants.Button.ThemeColor.Info)">@Localizer["Next"]</TelerikButton>        
    </FormButtons>
</TelerikForm>
	
	
@code{
	public TriggerDetailModel TriggerDetail { get; set; } = null!;
	public TriggerDetailValidator Validator { get; set; } = new();
	
    private void HandleValidSubmit()
    {
        var validationResult = Validator.Validate(TriggerDetail);
        if (validationResult.IsValid)
        {
            NextStep();
        }
        else
        {
            //Errores
        }            
    }
}

public class TriggerDetailValidator : AbstractValidator<TriggerDetailModel>
{                
        public TriggerDetailValidator()
        {           
            RuleFor(t => t.Name).NotEmpty();
            RuleFor(t => t.Group).NotEmpty();
        }
}

Where is the problem?

 

Thanks

Svetoslav Dimitrov
Telerik team
 answered on 18 Nov 2022
1 answer
136 views
Here is the sample that shows what is the issue.
Just check any child and click "clear" button. The "full checks" are removed correctly, but indeterminate ones stays.
@* Enable the CheckParents parameter and observe the behavior of this setting. *@

<TelerikTreeView Data="@FlatData"
                 @bind-ExpandedItems="@ExpandedItems"
                 CheckParents="true"
                 CheckBoxMode="@TreeViewCheckBoxMode.Multiple"
                 @bind-CheckedItems="@checkedItems">
    <TreeViewBindings>
        <TreeViewBinding IdField="Id" ParentIdField="ParentIdValue" TextField="Text" HasChildrenField="HasChildren" IconField="Icon" />
    </TreeViewBindings>
</TelerikTreeView>

<div>
    Checked items:
    <ul>
        @if (checkedItems.Any())
        {
            foreach (var item in checkedItems)
            {
                var checkedItem = item as TreeItem;
                <li>
                    <span>
                        <TelerikIcon Icon="@checkedItem.Icon"></TelerikIcon>
                    </span>
                    <span>
                        @(checkedItem.Text)
                    </span>
                </li>
            }
        }
    </ul>
    <button @onclick="Clear">clear</button>
</div>


@code {
    public IEnumerable<object> checkedItems { get; set; } = new List<object>();

    public class TreeItem
    {
        public int Id { get; set; }
        public string Text { get; set; }
        public int? ParentIdValue { get; set; }
        public bool HasChildren { get; set; }
        public string Icon { get; set; }
    }

    public IEnumerable<TreeItem> FlatData { get; set; }
    public IEnumerable<object> ExpandedItems { get; set; } = new List<TreeItem>();

    protected override void OnInitialized()
    {
        LoadFlatData();
        ExpandedItems = FlatData.Where(x => x.HasChildren == true).ToList();
    }

private void Clear() {
    checkedItems = new List<object>();
        StateHasChanged();
}

    private void LoadFlatData()
    {
        List<TreeItem> items = new List<TreeItem>();

        items.Add(new TreeItem()
        {
            Id = 1,
            Text = "Project",
            ParentIdValue = null,
            HasChildren = true,
            Icon = "folder"
        });

        items.Add(new TreeItem()
        {
            Id = 2,
            Text = "Design",
            ParentIdValue = 1,
            HasChildren = true,
            Icon = "brush"
        });
        items.Add(new TreeItem()
        {
            Id = 3,
            Text = "Implementation",
            ParentIdValue = 1,
            HasChildren = true,
            Icon = "folder"
        });

        items.Add(new TreeItem()
        {
            Id = 4,
            Text = "site.psd",
            ParentIdValue = 2,
            HasChildren = false,
            Icon = "psd"
        });
        items.Add(new TreeItem()
        {
            Id = 5,
            Text = "index.js",
            ParentIdValue = 3,
            HasChildren = false,
            Icon = "js"
        });
        items.Add(new TreeItem()
        {
            Id = 6,
            Text = "index.html",
            ParentIdValue = 3,
            HasChildren = false,
            Icon = "html"
        });
        items.Add(new TreeItem()
        {
            Id = 7,
            Text = "styles.css",
            ParentIdValue = 3,
            HasChildren = false,
            Icon = "css"
        });

        FlatData = items;
    }
}
Am I doing something wrong?
Dimo
Telerik team
 answered on 18 Nov 2022
0 answers
221 views

Hi,

Is there any way to add Footer Template to a column of Grid in blazor by C# code?

Vinh
Top achievements
Rank 1
 updated question on 18 Nov 2022
1 answer
180 views

I don't see a Class property on the GridColumn object.  Is there a way to style a specific column?  In my instance, i would like to remove the left border for just 1 of many columsn in the grid.

Thanks in advance.

Eric
Top achievements
Rank 2
Iron
Iron
 answered on 17 Nov 2022
2 answers
335 views

My app worked on v3.6.1 but when I upgraded to v3.7 I'm getting the error below. It has something to do with the TelerikDatePicker. If I remove the date picker it I don't get the error. Any way I can get around this?

 

fail: Microsoft.AspNetCore.Components.Web.ErrorBoundary[0]
      Microsoft.JSInterop.JSException: Cannot read properties of null (reading 'addEventListener')
      TypeError: Cannot read properties of null (reading 'addEventListener')
          at QM.bindEvents (https://localhost:7116/_content/Telerik.UI.for.Blazor/js/telerik-blazor.js:50:1755270)
          at new QM (https://localhost:7116/_content/Telerik.UI.for.Blazor/js/telerik-blazor.js:50:1756185)
          at Zt (https://localhost:7116/_content/Telerik.UI.for.Blazor/js/telerik-blazor.js:50:1029936)
          at Module.tE (https://localhost:7116/_content/Telerik.UI.for.Blazor/js/telerik-blazor.js:50:1756262)
          at https://localhost:7116/_framework/blazor.webassembly.js:1:3332
          at new Promise (<anonymous>)
          at Object.beginInvokeJSFromDotNet (https://localhost:7116/_framework/blazor.webassembly.js:1:3306)
          at Object.St [as invokeJSFromDotNet] (https://localhost:7116/_framework/blazor.webassembly.js:1:59938)
          at _mono_wasm_invoke_js_blazor (https://localhost:7116/_framework/dotnet..oafyft2lng.js:9073:37)
          at do_icall (wasm://wasm/031ebc56:wasm-function[3582]:0xc1359)
         at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[Microsoft.JSInterop.Infrastructure.IJSVoidResult, Microsoft.JSInterop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext()
         at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
         at Telerik.Blazor.Components.Common.Pickers.TelerikPickerBase`1.<InitPicker>d__119[[System.DateTime, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
         at Telerik.Blazor.Components.Common.Pickers.TelerikPickerBase`1.<OnAfterRenderAsync>d__115[[System.DateTime, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Dimo
Telerik team
 answered on 17 Nov 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?