Telerik Forums
UI for Blazor Forum
1 answer
58 views

Hi,

My data model looks like this, but I'm not sure how to map it to the grid.

It gives an error saying it isn't enumerable, which is true. How do I map complex fields as a sub-grid row?

 

        public class MainModel
        {
            public DetailsModel Order { get; set; }
            public DetailsModel2 Stuff { get; set; }
        }

        public class DetailsModel
        {
            public string OrderId { get; set; }
            public string DealSize { get; set; }
        }

        public class DetailsModel2
        {
            public string StuffId { get; set; }
            public string StuffSize { get; set; }
        }

 private List<MainModel> GenerateData()
        {
            List<MainModel> data = new List<MainModel>();
            for (int i = 0; i < 5; i++)
            {
                MainModel mdl = new MainModel()
                {
                    Order = new DetailsModel() { OrderId = i.ToString(), DealSize = i.ToString() }
                    ,
                    Stuff = new DetailsModel2() { StuffId = i.ToString(), StuffSize = i.ToString() }
                };
                data.Add(mdl);
            }
            return data;
        }

 

<TelerikGrid Data="salesTeamMembers">
    <DetailTemplate Context="TemplateItem">
        @{
            var Item = TemplateItem as MainModel;
            <TelerikGrid Data="Item.Order" Pageable="true" PageSize="5">
                <GridColumns>
                    <GridColumn Field="OrderId"></GridColumn>
                    <GridColumn Field="DealSize"></GridColumn>
                </GridColumns>
            </TelerikGrid>
        }
    </DetailTemplate>
    <GridColumns>
        <GridColumn Field="Order">Order</GridColumn>
        <GridColumn Field="Stuff">Stuff</GridColumn>
    </GridColumns>
</TelerikGrid>

Thanks!
Marin Bratanov
Telerik team
 answered on 23 Oct 2020
1 answer
492 views

Window-component:

<TelerikWindow @bind-Visible="@_visible">
    <WindowTitle>Window</WindowTitle>
</TelerikWindow>
<TelerikButton OnClick="Show">Toggle</TelerikButton>

@code
{
    private bool _visible;

    public void Show()
    {
        _visible = !_visible;
    }
}

Other component:

<WindowComponent @ref="_windowComp"/>
<TelerikButton OnClick="() => _windowComp.Show()">Show</TelerikButton>

@code {
    private WindowComponent  _windowComp;
}

Nothing happens when pressing the "Show"-button, although debugging clearly shows that the Show()-method is executed.

 

Svetoslav Dimitrov
Telerik team
 answered on 23 Oct 2020
1 answer
422 views

I have a Data grid which is populated with remote data 1 page at a time using OnRead. This requires custom sort and filtering in the OnRead method. When 

I was using filter row, and the filters were returned as FilterDescriptor, and their value was populated.

When I changed the setting to filtermenu, and started getting composite filters (which I wanted), the values were always null, regardless of what I entered. Is this the right way to get values from the composite filters? If so, why is the value of each FilterDescriptor always null?

 

                    if (filter is FilterDescriptor)
                    {
                        FilterDescriptor currFilter = filter as FilterDescriptor;

                        var member = currFilter.Member;
                        var operation = currFilter.Operator;
                        var value = currFilter.Value;
//value is not null
                    }
                    else if(filter is CompositeFilterDescriptor)
                    {
                        var filters = filter as CompositeFilterDescriptor;
                        foreach (var compFilter in filters.FilterDescriptors)
                        {
                            FilterDescriptor currFilter = compFilter as FilterDescriptor;

                            var member = currFilter.Member;
                            var operation = currFilter.Operator;
                            var value = currFilter.Value;
//value is always null
                        }
                    }

Svetoslav Dimitrov
Telerik team
 answered on 22 Oct 2020
8 answers
522 views

I have a grid that I have linked to an odata 4 source.

 

I use request.ToODataString() to build the URL in the onread event. 

 

if no filter is defined it works fine

 

/odata/BinMasterAllstock?$count=true&$skip=0&$top=100

as soon as any filter is set (or just the clear button of a filter drop down)  the ToODataString does the following

all filters including empty ones get included

GET /odata/BinMasterAllstock?$count=true&$filter=((contains(NameParentParentLoc,%27%27)%20and%20contains(NameParentParentLoc,%27%27))%20and%20(contains(ZNo,%27%27)%20and%20contains(ZNo,%27%27))%20and%20(QtyOnHand%20eq%20%20and%20QtyOnHand%20eq%20)%20and%20(contains(Zdesc,%27%27)%20and%20contains(Zdesc,%27%27))%20and%20(contains(LotNo,%27%27)%20and%20contains(LotNo,%27%27))%20and%20(contains(Extra0,%27%27)%20and%20contains(Extra0,%27%27))%20and%20(contains(Extra1,%27%27)%20and%20contains(Extra1,%27%27))%20and%20(contains(Extra2,%27%27)%20and%20contains(Extra2,%27%27))%20and%20(contains(Extra3,%27%27)%20and%20contains(Extra3,%27%27))%20and%20(contains(Extra4,%27%27)%20and%20contains(Extra4,%27%27))%20and%20(contains(Extra50,%27%27)%20and%20contains(Extra50,%27%27))%20and%20(contains(NameParentLoc,%27a%27)%20and%20contains(NameParentLoc,%27%27)))&$skip=0&$top=100

 

Of course that is not well formed and a bad request is returned.

What am I missing.

Svetoslav Dimitrov
Telerik team
 answered on 21 Oct 2020
2 answers
390 views
I use 

   [Parameter] public RenderFragment GridCommandColumn { get; set; }

and

    <GridCommandColumn >
      <GridCommandButton Command="Edit" Icon="edit" />
      @GridCommandColumn
    </GridCommandColumn>

I get the following compiler error:
    Unrecognized child content inside component 'TelerikGrid'. 
    The component 'TelerikGrid' accepts child content through the following top-level items: 'GridAggregates', 'GridColumns', 'GridToolBar', ...

I don't understand why the compiler says that @GridCommandColumn needs to be a TelerikGrid RenderFragment.
I would think this is "my" RenderFragment, and the TelerikGrid would only see the rendered GridCommandButtons.

Is there some way to let a parent component insert GridCommandColumns into my <TelerikGridWrapper>?
Marin Bratanov
Telerik team
 answered on 21 Oct 2020
1 answer
111 views

Im trying to allow multiple files to be uploaded, but instead of getting all the files sent into the handler, its one at a time, at least with Chrome.

What can I check?

My save api handler has a signature like this

[HttpPost]
public async Task<IActionResult> Save(IEnumerable<IFormFile> files, string SelFileType)

If I have 3 files selected for example, that method gets called 3 times each with a seperate file, instead of 1 with a collection of IFormFile objects

The upload control

<TelerikUpload SaveUrl="@SaveUrl" Multiple="true"                               
               OnUpload="@OnUploadHandler"  OnSelect="@OnFileSelectHandler" OnError="@OnFileErrorHandler" OnSuccess="@OnSuccessHandler"/>
Marin Bratanov
Telerik team
 answered on 21 Oct 2020
3 answers
338 views

when I click on the filter icon of the grid I get this error

 

Microsoft.JSInterop.JSException: Could not find 'showAnimationGroupAsync' in 'window.TelerikBlazor'.
Error: Could not find 'showAnimationGroupAsync' in 'window.TelerikBlazor'.

 

I am using Telerik.UI.forBlazor 2.17.0

 

and i am referencing the local JS file _content/Telerik.UI.for.Blazor/js/telerik-blazor.js

 

I am not sure what is causing this error, any help would be appreciated 

 

Thanks

 

 

Marin Bratanov
Telerik team
 answered on 21 Oct 2020
4 answers
646 views

Hello,

I was wondering if it is possible when Multiple Selection Mode is turned on that you don't have to press CTRL first to select multiple dates.

So what I want is the functionality that you get when you press CTRL+click but I don't want to press and hold CTRL.

Or is there a workaround to make this possible?

 

Joeri
Top achievements
Rank 1
Veteran
 answered on 20 Oct 2020
1 answer
1.0K+ views

Hey,

iam evaluating the blazor components for our new project. Our customer has complex validation rules so FluentValidation is for us required. In my PoC i tried to use FluenValidation inside a PopOut but i was not able. Is there a solution to use FluenValidation in the PopOut instead of datanotations? I'm using this package https://github.com/ryanelian/FluentValidation.Blazor. This is my Code

<FluentValidator Validator="validator" />
 <TelerikGrid Data="personList"
                 Pageable="false"
                 Sortable="true"
                 Resizable="false"
                 EditMode="GridEditMode.Popup"
                 OnUpdate="@UpdateOrCreateHandler" OnDelete="@DeleteHandler" OnCreate="@UpdateOrCreateHandler">
...
</TelerikGrid>

private List<Person> personList;

PersonValidator validator = new PersonValidator();

 

With the component call "<FluentValidator Validator="validator" />" i get this error:

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: DataAnnotationsValidator requires a cascading parameter of type EditContext. For example, you can use DataAnnotationsValidator inside an EditForm.
System.InvalidOperationException: DataAnnotationsValidator requires a cascading parameter of type EditContext. For example, you can use DataAnnotationsValidator inside an EditForm.
  at Microsoft.AspNetCore.Components.Forms.FluentValidator.OnInitialized () <0x3c7cef0 + 0x00018> in <filename unknown>:0
  at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x306e830 + 0x00030> in <filename unknown>:0

 

Is there a solution to work with fluentvalidation?

Marin Bratanov
Telerik team
 answered on 20 Oct 2020
8 answers
194 views
Is there a way to turn off the "retry" element after a file has been selected and it has errored?
BitShift
Top achievements
Rank 1
Veteran
 answered on 19 Oct 2020
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?