MultiSelect does not have records if wasn't shown after first render of page

If the multiselect component was not shown after first render (the "if" statement is false so multiselect was not added to layout) then if we want to show it later (make "if" statement true and add multiSelect to layout) it will have no records.

There are two exactly same multiselects, but second is inside "if" statement and was shown after button click.



<SfButton OnClick="@((_) => show = true)">Show</SfButton>
@if (show)
{
     <SfMultiSelect ID="NameMultiSelect" @bind-Value="@selectedNames" Mode="VisualMode.CheckBox" TValue="string[]" DataSource="@names">
     </SfMultiSelect>
}

@code
{
     private bool show = false;
     private string[] selectedNames;
     private string[] names;

     protected override async Task void OnInitializedAsync()
     {
          await base.OnInitializedAsync();

          names = new string[] { "A", "B" };
     }
}

1 Reply

SN Sevvandhi Nagulan Syncfusion Team October 15, 2020 02:41 PM UTC

Hi Yaroslav, 


Greetings from Syncfusion support. 


We checked the reported requirement. We made sample with the provided code snippet and we cannot reproduce the mentioned issue. Here we have attached the ensured sample. Kindly check with the attached sample and provide an issue replicating sample by modifying the below attached sample that will help us to further validate the issue and provide you with a better solution from our end. 






Regards, 
Sevvandhi N 


Loader.
Up arrow icon