onfocus="this.select();" does not seem to work in newest version in NumericEdit
In the older version 0.9.0.3 on a NumericEdit, I was able to user onfocus="this.select();"
This is throwing an error in the 0.9.4.1.
The goal is when the user enters the input that the current text gets selected so when they type it replaces what is there by default.
This worked in 0.9.0.3:
<<NumericEdit TValue="decimal" Decimals="2" Value="@(Convert.ToDecimal(val))" ValueChanged="@(v => ((CellEditContext)context).CellValue = v)" Size="Size.ExtraSmall" Margin="Margin.Is0" Padding="Padding.Is0" onfocus="this.select();" />>
In 9.4.1 I get this error:
System.InvalidOperationException: Unable to set property 'onfocus' on object of type 'Blazorise.Bootstrap.NumericEdit
1[[System.Double, System.Private.CoreLib, Version=22.214.171.124, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'. The error was: Unable to cast object of type 'System.String' to type 'Microsoft.AspNetCore.Components.EventCallback1[Microsoft.AspNetCore.Components.Web.FocusEventArgs]'.
---> System.InvalidCastException: Unable to cast object of type 'System.String' to type 'Microsoft.AspNetCore.Components.EventCallback
1[Microsoft.AspNetCore.Components.Web.FocusEventArgs]'. at Microsoft.AspNetCore.Components.Reflection.PropertySetter.CallPropertySetter[TTarget,TValue](Action2 setter, Object target, Object value)
The reason why error happens is that we now have a dedicated event handler that you can use instead. It is named
OnFocus. You just need to replace attributes.
I have re-read your message and I can now understand what you meant. When
onfocus="this.select();" is used without the
We would need to add new API into Blazorise NumericEdit to be able to support this. I suggest to add
.Select() method that could be used along with existing
Since it is introducing new API it is not possible to add as part of 0.9.4, but I will schedule it for 0.9.5 and it will be done as part of the first preview.
Also you should still be able to bind to the Blazorise
select function with some minor changes, right?