Telerik Forums
UI for Blazor Forum
0 answers
285 views

Hello. 

I got three charts and I want to apply the primary, secondary and tertiary colors of the selected theme respectively. 

It's a silly question but I didn't figure it out. I've tried setting the Color property of the series to ThemeColors.Secondary or adding differents combinations of styles to the chart. Nothing worked properly. The only way at the moment is to set the color (rgb, hexa, etc) manually in the Color property of the series. Since the theme can be changed at runtime, I would like to use the theme colors and not have them fixed.
  Any suggestion?

By the way, if a don't set the color property it gets the ThemeColors.Primary value... unfortunatelly all charts will have the same color and trying to avoid it.

Regards,
Brazorist.

Blazorist
Top achievements
Rank 2
Bronze
Iron
Iron
 asked on 20 Apr 2021
1 answer
938 views

Is there a way to handle @onkeydown event on <TelerikEditor>?

I tried this way:

<TelerikEditor Id="myEditor" @bind-Value="@myEditorValue" @onkeydown="OnKeyDownMyEditor"></TelerikEditor>

and i get the error:

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Object of type 'Telerik.Blazor.Components.TelerikEditor' does not have a property matching the name 'onkeydown'.
System.InvalidOperationException: Object of type 'Telerik.Blazor.Components.TelerikEditor' does not have a property matching the name 'onkeydown'.

 

I get this kind of error any time i try to handle an event in a Telerik component using the regular Blazor way, so i guess this is not the proper way to do it.

Marin Bratanov
Telerik team
 answered on 20 Apr 2021
1 answer
1.6K+ views

Hello,
I have an issue with Unit tests that used to work.
I’m using bUnit to test the Blazor Autocomplete; before the (latest (not sure though)) update the tests passed.
The tests do the following:
1. bUnit renders the autocomplete
2. I use bUnit to fill in 2 chars in the autocomplete
3. The OnRead for the Autocomplete should get triggered
4. The autocomplete should than call a service method, which I mocked (using Moq)
5. I than assert the Mocked service method to be hit at least once

This used to work like a charm, but now it seems that the OnRead doesn’t get hit.

Were there any changes in when the OnRead Event gets triggered for the Autocomplete?

I decided to create a post here instead of a bUnit github issue; since the bUnit version remained the same (since the working version).

Here is some example code:
a. Component code behind:
public async Task OnRead(AutoCompleteReadEventArgs args)
{
Telerik.DataSource.FilterDescriptor filter = args.Request.Filters[0] as Telerik.DataSource.FilterDescriptor;
if (args.Request.Filters.Count < 0)
return;
string userInput = filter.Value.ToString();
if (string.IsNullOrWhiteSpace(userInput))
{
await SetToZero(); //defaults some values
return;
}
await CallService(userInput);
}
b. Component markup: <TelerikAutoComplete Data="@_data "
ClearButton="true" OnRead="@OnRead" OnChange="@OnChange"
FilterOperator="Telerik.Blazor.StringFilterOperator.Contains"
Filterable="true"
MinLength="2" //OnRead only gets hit when min 2 chars are provided
Placeholder="@PlaceHolderValue" @bind-Value="@Value"/>
c. bUnit test
Mock<InterfaceToMock> mock = new Mock<InterfaceToMock>();
mock.Setup(c => c.GetSomethingByInput(It.IsAny<string>()))
.Returns(Task.FromResult(new List<Something>()));
ctx.Services.AddScoped(sp =>
{
return mock.Object;
});
var rootComponentMock = new Mock<TelerikRootComponent>();
var cut = ctx.RenderComponent<TheComponentContainingtheAutocomplete>
(rc => rc.AddCascadingValue(rootComponentMock.Object));
cut.Find("input").Input("t");
cut.WaitForAssertion(() =>
{
//This passes
countryAutocompleteMock.Verify(m => m.GetCountriesByName(It.IsAny<string>()), Times.Never());
});
cut.Find("input").Input("tt");
cut.WaitForAssertion(() =>
{
//This fails, while it should’ve been called by the OnRead
countryAutocompleteMock.Verify(m => m.GetCountriesByName(It.IsAny<string>()), Times.Once());
});

Any idea why the OnRead doesn’t get called when 2 char input is provided in the AutoComplete within the test?
It does get called when debugging the component.
Thanks in advance!

Marin Bratanov
Telerik team
 answered on 20 Apr 2021
1 answer
343 views

In my grid pop-up form the validation summary looks out of place when I add my own list of errors.

I have added pictures of the code and how it looks.

Please take a look at it, looks very stranges

Nadezhda Tacheva
Telerik team
 answered on 20 Apr 2021
0 answers
587 views

Hi,

We are using among other components the TreeView component for showing an hierarchical view of an organization and that works fine in most cases, there is however an issue that happens when the users are quick to navigate between views and we get an error:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Cannot read property 'addEventListener' of null
      TypeError: Cannot read property 'addEventListener' of null

After some investigation of the code and how the TreeView works we can see that this probably happens due to that the OnAfterRenderAsync of the TreeView runs InitTreeView which calls JSInterop to set event handling for example:

this.element.addEventListener(h, this.onKeyDown),
this.element.addEventListener(f, this.onMouseDown),
this.options.draggable && this.createDraggable()

but since this is run in OnAfterRenderAsync it may happen even after the component is disposed and removed from the DOM so the elements are no longer available and the error occurs.

Is this a known issue and is there a way to handle it?

Best regards

Johan

Johan
Top achievements
Rank 1
 asked on 20 Apr 2021
3 answers
285 views

My tabs are taking a little of bit time to change when clicked on making it look like nothing is happening when they click on  tab.

I need a way to some kind of Please Wait when a tab is clicked on and then goes away once the new tab is rendered.  

I am thinking something like the three pulsing dots in the tab title while it is working.

Is there any way I can achieve this?

Marin Bratanov
Telerik team
 answered on 19 Apr 2021
11 answers
3.6K+ views
Can I hide vertical scroll bar?
In this example scroll bar present but absolutely unusable https://demos.telerik.com/blazor-ui/grid/custom-editor
Thank you.
Flemming
Top achievements
Rank 1
Veteran
 answered on 19 Apr 2021
3 answers
127 views

Hello,


I have an issue that I'd like to share with you.
I have the following setup:
Razor:
@if (_isEditMode && _aListOfStrings.Any())
{
<TelerikAutoComplete Data="_aListOfStrings"
Filterable="true"
FilterOperator="StringFilterOperator.Contains"
@bind-Value="_aViewModel.aStringProperty">
</TelerikAutoComplete>
}


Code behind:
protected override async Task OnParametersSetAsync()
{
await GetTheStringList();
}


private async Task GetTheStringList ()
{
_aListOfStrings = _aService.GetTheListOfStrings();
}

 

The autocomplete renders like expected. The data is also shown and filtered like expected. For some reason, when I type a string that is present in "_aListOfStrings" and select it for the first time. The string is not filled-in the autocomplete, nor does it get bound to the model. The second time I filter and select the string, it does get filled in and bound to the model.
Do you guys have any idea why this happens? I can't seem to figure it out. This is happening for all autocompletes in this "form". I've tried the following:
1. Render the Autocomplete outside of the Form
2. Set an id
3. Call this.StateHasChanged() after retrieving the data for the list
4. Changed OnParametersSetAsync() to OnInitilizedAsync() to fetch the list
Thanks in advance!

Hristian Stefanov
Telerik team
 answered on 19 Apr 2021
2 answers
1.0K+ views

First a salute to the Telerik team. The Grid is awesome, thanks for making me look like a rock star.

I am using the build in Blazor FileUpload component, not Telerik and would like to show validations errors in the pop-up form for not supported file types.

How can I show errors in a component like the Validation Summary?

 

Marin Bratanov
Telerik team
 answered on 16 Apr 2021
7 answers
487 views

I want negative #'s to show as -9999 not (9999). 

Is there any way to do this?  

I could do it with the Kendo controlsby putting kendo.culture().numberFormat.currency.pattern[0] = "-$n"; in the document.ready function but I can't see to figure out how to do it with Blazor controls.

Thanks.

Marin Bratanov
Telerik team
 answered on 16 Apr 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?