-
Hi, I have a DataGrid that contains the following columns: Quantity, Rate, Discount, and Amount When a value is changed, I update the other values (e.g. when Quantity is changed, the Amount is updated, when Amount is changed, the Rate is updated, etc...) My code block looks like this:
While the above code works, I noticed that there is quite a noticeable lag or delay each time a character is typed or maybe everytime a key is pressed? I'm guessing it is because, every time a key is pressed, all ValueChange() of my input controls are called? Since this is a common functionality in many web apps, I'm guessing I am NOT doing this correctly? Maybe there is a correct or a better way to achieve my goal? Please share, I am very much willing to learn :) By the way, I am running it in VS2019 community edition, I think in Debug mode (I don't really know how to use this yet, I'm still new to software development, but it says Debug)...Do I need to setup anything to test this in Release mode? And is performance different between Debug and Release mode? Thanks in advance! In case my razor code is also needed, I am posting it below for everyone's reference:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Well, the problem is much bigger. It's basically a known problem in Blazorise/Blazor. Whenever you type something the component value must be updated, and also need to run the validation, and also update any validation state or error message. This means that Blazor will re-render parts of the UI. I hope with time this will be better as Blazor team roles some render optimizations. I have made many optimizations recently(for 0.9.3) but the problem still occurs in some cases. You can try enabling |
Beta Was this translation helpful? Give feedback.
Well, the problem is much bigger. It's basically a known problem in Blazorise/Blazor. Whenever you type something the component value must be updated, and also need to run the validation, and also update any validation state or error message. This means that Blazor will re-render parts of the UI. I hope with time this will be better as Blazor team roles some render optimizations.
I have made many optimizations recently(for 0.9.3) but the problem still occurs in some cases. You can try enabling
DelayTextOnKeyPress
and increasingDelayTextOnKeyPressInterval
. This way you will have some kind of hybrid betweenonchange
andoninput
events. And the last option is to disable immediate updates on…