Telerik Forums
UI for Blazor Forum
7 answers
1.5K+ views

Hello -

I've been really enjoying my time with the Telerik Blazor Grid component, but I'm running into trouble with the filtering functionality.  This is using a Blazor Web Assembly Client with a ASP.NET Core 3 backend.  When my client requests data from the API without a filter, I get appropriate responses as expected.  Paging works great, everything is good.  As soon as I try any off-the-shelf filter, I get an error response from the server with the message :

Could not create an instance of type Telerik.DataSource.IFilterDescriptor. Type is an interface or abstract class and cannot be instantiated.

It looks like this is some sort of deserialization error that is being run into when the server is trying to parse my DataSourceRequest.  It gets parsed fine without a filter, but as soon as I try to filter, I get the above message.

Has anyone else seen and tackled this problem?  Thanks much!

- Chris

 

Jordy
Top achievements
Rank 1
Iron
 answered on 18 May 2022
4 answers
408 views

I don't see any loading indicator when going between pages of a grid with remote data... are there plans for this?

web
Top achievements
Rank 2
Veteran
Iron
 answered on 17 May 2022
0 answers
120 views
i have one button when i click that button it will excecute storedprocedure and generate excel file in Asp.net core Blazor Application
Pranay
Top achievements
Rank 1
 asked on 17 May 2022
1 answer
394 views

I am using a TreeView control that displays checkboxes for each node and the checked state of each node seems to get lost when the parent node is collapsed and expanded again.  However, this only seems to happen when the OnExpand event is handled. Remove the OnExpand event handler and everything works as expected. It doesn't seem to make a difference if the event args property ShouldRender is set to true. Happens for both flat and hierarchical data.

Can't imagine that this is the desired behaviour. If it is then is there any way around it as I do need to handle the OnExpand event in my code behind.

The following is test page the displays this problem...

@page "/treeview"
@using System.Linq

<TelerikTreeView Data="@Data" CheckBoxMode="@TreeViewCheckBoxMode.Multiple" CheckChildren="true" CheckParents="true"
                 @bind-CheckedItems="@CheckedItems" OnExpand="@OnExpandHandler">
                 @*@bind-ExpandedItems="@ExpandedItems"*@
    <TreeViewBindings>
        <TreeViewBinding IdField="Id" TextField="Text" HasChildrenField="HasChildren" ItemsField="Children">
            <ItemTemplate>
                @{ 
                    var item = context as MyTreeItem;
                    <div>@item.Id.ToString() : @item.Text</div>
                }
            </ItemTemplate>
        </TreeViewBinding>
    </TreeViewBindings>
</TelerikTreeView>

@code {
    private IEnumerable<MyTreeItem> Data { get; set; }
    private IEnumerable<object> CheckedItems { get; set; } = Enumerable.Empty<object>();
    private IEnumerable<object> ExpandedItems { get; set; } = Enumerable.Empty<object>();
    private int LastID = 0;

    protected override void OnInitialized()
    {
        Data = CreateNodeList("one", "two", "three", 3);
    }

    private List<MyTreeItem> CreateNodeList(string name1, string name2, string name3, int levels = 0)
    {
        var list = new List<MyTreeItem>();
        list.Add(CreateNode(name1, levels));
        list.Add(CreateNode(name2, levels));
        list.Add(CreateNode(name3, levels));
        return list;
    }

    private MyTreeItem CreateNode(string name, int levels)
    {
        LastID++;
        var node = new MyTreeItem { Id = LastID, Text = name };
        if (levels > 0)
        {
            node.Children = CreateNodeList($"{name} - one", $"{name} - two", $"{name} - three", levels - 1);
        }
        return node;
    }

    private async Task OnExpandHandler(TreeViewExpandEventArgs args)
    {
        //await InvokeAsync(StateHasChanged);
        //args.ShouldRender = true;
    }

    private class MyTreeItem 
    {
        public int Id { get; set; } = 0;
        public string Text { get; set; } = "";
        public IList<MyTreeItem> Children { get; set; } = null;
        public bool HasChildren => Children is not null && Children.Count > 0;
    }
}

Tsvetomir
Telerik team
 answered on 17 May 2022
1 answer
333 views

Hi,

Is there a way to change the position of the small Arrow of the tooltip through css ?

 

thx!

Robert
Top achievements
Rank 1
Iron
Iron
 updated answer on 17 May 2022
1 answer
193 views

Hello,

I'm still trying to produce a reproducible scenario in Repl to share, but upgrading to 3.3.0 broke our treeview drop code. If I revert back to 3.2.0 it begins to work properly again.  I have a typical tree with several "folders" & "files" which I can drag and drop to re-organize. The only time telerik shows the circle with a slash drag hint is when you drag the source node over top itself. In 3.3.0 it seems that the circle with the slash is showing up over most but not all of the nodes in the tree. I can't explain why it thinks some areas are valid drop targets and others are not. One node is fine to drop on and the next and previous ones show the No Drop icon. 

I'll continue to try and make a Repl example but wanted to raise awareness of this sooner than later.

Thanks,

-Andy 

Andrew
Top achievements
Rank 1
Iron
Iron
 answered on 16 May 2022
1 answer
548 views

Hello

We have added validation to the Grid using Fluent Validation and this works perfectly. However in the validation we have to go to a back-end API to check if the value is not a duplicate.

The current behavior is that the Fluent Validation goes off whenever you type, this causes a lot of load on the API. Is there a way to change this? Maybe so it only occurs when you press the Save button, or when you leave the input field, or after x seconds of no typing...

Another valid option would be to do the check in the Update or Create Handler, but how do we display a nice error message that way to the user?

Thank you in advance

Thomas

 

Tsvetomir
Telerik team
 answered on 16 May 2022
1 answer
199 views

Opening the page it return this error on chrome console:

 

System.AggregateException: One or more errors occurred. (Could not load list of method overrides due to Method not found: System.Collections.Generic.IList`1<Microsoft.Extensions.Configuration.IConfigurationSource> Microsoft.Extensions.Configuration.IConfigurationBuilder.get_Sources())
 ---> System.TypeLoadException: Could not load list of method overrides due to Method not found: System.Collections.Generic.IList`1<Microsoft.Extensions.Configuration.IConfigurationSource> Microsoft.Extensions.Configuration.IConfigurationBuilder.get_Sources()
   at Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder.CreateDefault(String[] args)
   at BlazorRepl.Client.Program.Main(String[] args)
   --- End of inner exception stack trace ---
callEntryPoint @ blazor.webassembly.js:1
VM262:1 Uncaught ReferenceError: webVitals is not defined
    at <anonymous>:1:313
    at gtm.js?id=GTM-6X92:502:414
    at HTMLScriptElement.<anonymous> (gtm.js?id=GTM-6X92:503:118)

Dimo
Telerik team
 answered on 16 May 2022
1 answer
276 views

I have a grid defined with SelectionMode="GridSelectionMode.Single".  I'm handling the SelectedItemsChanged event and when returning the previously selected row is selected with the newly selected row.  This appears to be happening when an async call to a web api using http client is made.  If I comment out the http call the selection works as expected.

Can someone explain why the http client call could be impacting the selection functionality or how I may go about debugging this?


	

<div ><div ><label for="label">Labels</label><div ><TelerikGrid Data="@Labels" FilterMode="@GridFilterMode.FilterRow" ScrollMode="GridScrollMode.Scrollable" SelectionMode="GridSelectionMode.Single" SelectedItems="@SelectedLabels" SelectedItemsChanged="@((IEnumerable<LabelDto> labelList) => OnSelectAsync(labelList))" Height="200px"><GridColumns><GridColumn Field="@(nameof(LabelDto.Name))"></GridColumn></GridColumns></TelerikGrid></div></div></div> public partial class LabelSelection { private ObservableCollection<LabelDto>? _labels; private int? _selectedValue; public IEnumerable<LabelDto> SelectedLabels { get; set; } = Enumerable.Empty<LabelDto>(); protected async Task OnSelectAsync(IEnumerable<LabelDto> labels) { var l = labels.ToList(); SelectedLabels = l; if (l.Any()) await LabelChangedAsync(l[0]); StateHasChanged(); } ... } public async Task LabelChangeHandlerAsync(LabelDto label) { _currentLabel = label; var labelWithAttributes = await LabelRepo.GetLabelAsync((int)label.Id); //LabelAttributeList.Clear(); //if (labelWithAttributes.Attributes.Any()) //{ // LabelAttributeList.AddRange(labelWithAttributes.Attributes); //} }

 

        public async Task<LabelWithAttributesDto> GetLabelAsync(int id)
        {
            var req = $"labels/{id}?includeAttributes=true";

            _logger.Log(LogLevel.Warning, $"GetLabelsAsync({_client.BaseAddress}{req})...");

// The next call will cause multiple rows to be selected. Commenting this out will make the selections work.
           var apiResponse = await _client.GetStreamAsync(req);
//_logger.Log(LogLevel.Warning, $"...back from GetLabelsAsync({_client.BaseAddress}{req})");

//var label = await JsonSerializer.DeserializeAsync<LabelWithAttributesDto>
//    (apiResponse, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });

//return label;
return new LabelWithAttributesDto(1, "new", "filename", "100", new List<LabelAttributeDto>());
        }


Marin Bratanov
Telerik team
 answered on 15 May 2022
2 answers
2.5K+ views

I want to make a Custom GridCommandbutton Visible based on a value in the row.

For example, if the Status column of a row is 2, I want the command button to be visible, otherwise I want it hidde.

Is this possible?

 

Jay
Top achievements
Rank 1
Iron
 updated answer on 12 May 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?