How can i refresh my custom compoenent inside of SfTab

Hi great suppoort,

I have simple tab;



When i change my below readio button, i want to trigger CustomComponent1 's OnInitialized method. (actually i want to refresh(triegger OnInitialized ) selected tab)

I can achive this with swithing tabs two times but i didnt like this solution.
await Tab.Select(Tab.SelectedItem + 1);
await Tab.Select(Tab.SelectedItem - 1);

Do you have any better solution?

Thanks in advance.


3 Replies 1 reply marked as answer

VM Vengatesh Maniraj Syncfusion Team June 5, 2020 11:25 AM UTC

Dear Customer,

 

Thanks for contacting Support.

 

We have checked your reported query “how to refresh custom component inside Tab” with shared sample code and you can invoke the OnInitialized method of CustomComponent1 by applying conditional statements based on the checked value of Radio button. Refer the below code for that.

 

<SfTab LoadOn="ContentLoad.Dynamic">

<TabItems>

<TabItem>

<ChildContent>

<TabHeader Text="tab1"></TabHeader>

</ChildContent>

<ContentTemplate>

@if (IsChecked) // To Refresh Customcomponent1 based on the IsChecked value

{

<CustomComponent1></CustomComponent1>

}

else

{

<CustomComponent1></CustomComponent1>

}

</ContentTemplate>

</TabItem>

...

</TabItems>

</SfTab>

<br />

<SfRadioButton Name="donemRadio" Value="1" @bind-Checked="IsChecked"></SfRadioButton>

<SfRadioButton Name="donemRadio" Value="2"></SfRadioButton>

 

@code{

public bool IsChecked { get; set; } = true;

}

 

Also, you can download this sample using the following link.

Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/TabComponent-1997165823

 

Kindly try with a shared solution and get back to us, If you need further assistance.

 

Regards

Vengatesh

Marked as answer

BL Blazor June 5, 2020 06:33 PM UTC

Thanks Great Supoort,

It this is clever solution .


VM Vengatesh Maniraj Syncfusion Team June 8, 2020 05:36 AM UTC

Dear Customer, 

You are most welcome. 
  
Please get in touch with us if you need any further assistance. 

Regards, 
Vengatesh  


Loader.
Up arrow icon