I have an sfgrid control.I have loaded data source from api in "OninitializeAsync".It works fine on initial load.I would like to know why grid control is "rerendered" when I click on button.
Note:-
There is no action on button click, I have just click on button but why grid control is rerendered.
I would like to prevent rerendered of grid control when I click on button.
Thanks for reply..
I am facing this issues in Blazor Web Assembly.Please help how to resolve this issue...
please check attached example code for web assembly code which I modified....
Awaiting for reply...
|
SfGrid<Order> Grid;
...
public void ButtonClick()
{
Grid.PreventRender();
count++;
}
|
Thanks for reply....
Noted the above points...
Please clarify my below points
1.I have 10 combobox and one grid control and one button control
When I click on button,wheather we need to use above code for all control to prevent render ???
Or Is there any alternative solution to prevent render ???
2.If I use cascading filter combobox, wheather we need to use above code to prevent render ???
3.If I use enter key for tab index using js code,then we need to apply same code as above ???
4.If I just select the value from combobox, then we need to apply the same code ??
5.Is above code required for blazor server ???
awaiting for reply ???
Hope we will get reply today ....
Please help..
Still awaiting for prompt reply
|
private void ButtonClick()
{
shouldRender = false;
currentCount++;
}
protected override bool ShouldRender()
{
return shouldRender;
} |
Thanks for reply...
I have an clarification on cascading filter combobox.
If I set ShouldRender = false on "Combobox Change Event", whether this cascading filter will work ??
Thanks for clarification..
ShouldRender is not solved my problem..
Actually I have two component
1.List Page (contains one Addnew button and grid control)
2.Entry Page (which contains four combobox and two button control "save" and " Back" button).
As per above reply,"Grid.PreventRender" is working fine when I click Addnew button in list page
I would like to know how to use prevent render method for all components when I click save and back button click.
Note:-
I have set "ShouldRender = false" in save and back button click event but its not working (Its not going back to List Page)
I would like to goback to list page when I click on save and back button click without re rendering all component.
Hope its clear...
awaiting for reply...
|
@using Syncfusion.Blazor.DropDowns;
@typeparam TVal;
@typeparam TItemss;
<SfComboBox TValue="TVal" TItem="TItemss" DataSource="@customData">
<ComboBoxFieldSettings Text="Text" Value="Text"></ComboBoxFieldSettings>
</SfComboBox>
<button class="btn btn-primary" @onclick="ButtonClick">Click me</button>
<p>Count: @currentCount</p>
@code {
private int currentCount = 0;
private bool _shouldRender = false;
private void ButtonClick()
{
_shouldRender = false;
currentCount++;
}
protected override bool ShouldRender()
{
return _shouldRender;
}
[Parameter]
public List<TItemss> customData { get; set; }
[Parameter]
public EventCallback<TVal> DDLValueChanged { get; set; }
} |
Thanks for reply....
but above example is still not solved my problem..
please check attached example code and advise how to solve this issues.
Explanation:-
I have two combobox and two button control in my razor page.
When I click on First button,it should show first combobox without re-render of second combobox
When I click on second button,it should show second combobox without re-render of first combobox
Hop this example is clear
Attachment: BlazorApp1_ec9c54e4.zip
Is it possible to get reply today ??
please help...
Hope will get reply today...
awaiting for soonest reply...
Hi KINS,
Query: When I click on First button, it should show first combobox without re-render of second combobox. When I click on second button, it should show second combobox without re-render of first combobox
Based on your reported requirement, we suspect that on every button need to show without re-rendering of the another component. By default, re-rendering will remove the selected values maintained from the component. So, we suggest you to enable the EnablePersistance property to maintain the previously selected value of the component so in order to avoid the rendering causes like removing the value from input.
Please make a try with the below suggestion in your application and update whether meets your requirement.
|
@if (Mode == "First") { <SfComboBox ID="ComboBox1" EnablePersistence="true" TValue="string" TItem="GameFields" Placeholder="First Combobox" DataSource="@Games"> <ComboBoxEvents TValue="string" TItem="GameFields" ValueChange="CHangeHandler"></ComboBoxEvents> <ComboBoxFieldSettings Value="ID" Text="Text" /> </SfComboBox> }
@if (Mode == "Second") { <SfComboBox ID="ComboBox2" EnablePersistence="true" TValue="string" TItem="GameFields" Placeholder="Second Combobox" DataSource="@Games"> <ComboBoxEvents TValue="string" TItem="GameFields" ValueChange="CHangeHandler"></ComboBoxEvents> <ComboBoxFieldSettings Value="ID" Text="Text" /> </SfComboBox> } |
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp160992888
Regards,
Ponmani M
In that case,how "ShouldRender" life cycle will work..
that means, no need to change the should render variable (true/false) ???
Hi KINS,
Query: that means, no need to change the should render variable (true/false) ???
Yes, you do not need to use the ShouldRender life cycle method instead, you can use the EnablePersistance property to meet your requirement.
Regards,
Ponmani M
Can I use " EnablePersistence" in Grid to avoid Re-rendering instead of "grid.PreventRender" method ??
Hi KINS,
By default, in Grid component we have the method “to prevent the unwanted re-rendering of the component”. So that we suggested to use the PreventRender method in Grid component.
Enabling persistence won’t prevent rendering of grid, it will just maintains the previous grid’s state on component re-rendering. So if EnablePersistence meets your requirement, we suggest you to use this property in Grid component.
https://blazor.syncfusion.com/documentation/datagrid/state-management
But, whereas in ComboBox component, we don’t have specific support, so we suggest you to use the EnablePersistance property to meet your requirement.
Regards,
Ponmani M