Property to configure component options instead of set each attribute in component razor declaration

1 Answer 24 Views
General Discussions
Claudio
Top achievements
Rank 2
Iron
Iron
Iron
Claudio asked on 06 May 2022, 08:42 AM

It would be glad to add a property in telerik blazor components allow to manage all component settings.

This because some components has many attributes and binding to single properties on class is a nightmare.

It was done in angular with k-options attribute, in blazor can be for example:


<TelerikGrid Data="" Pageable="" PageSize="" Sortable="" Resizable="" Reorderable="" SelectionMode="" EditMode="" OnRead="" OnCreate="" OnUpdate="" OnCancel=""> ... </TelerikGrid>

 

to


<TelerikGrid Options="Options"> ... </TelerikGrid>

 

@code

{

private TelerikGridOptions<Model> Options {get;set;}

 

protected override void OnInitialized()

{

Options = new TelerikGridOptions<Model>

{

...

};

}

}


1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 07 May 2022, 03:36 PM

Hello Claudio,

In Blazor, the way to do this is to create a component in your app, and put the Telerik component with the desired parameters in it. Thus, you can reuse that custom component and expose on it only a few of the settings you plan to modify/set, and the events you may need (say, ones for two-way binding of parameters). Then you can reuse your custom component by giving its parameters values in any way you desire - be that as separate parameters, be that as some sort of unified collection of settings.

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Claudio
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Marin Bratanov
Telerik team
Share this question
or