How to set Select Item programmatically,

In my task ListView should show some default item when is it is created, and user is able to change the choice.

Before 19.3 version update I did the next:

    private void OnCreated()

    {

        if (Value != null) FilterListView..SelectItem(Value);

        else if (NotSet != null) FilterListView.SelectItem(NotSet);

        StateHasChanged();

    }

Now SelectItem method does not exist. What is the alternative for programmatical cho


1 Reply

KR Keerthana Rajendran Syncfusion Team October 4, 2021 05:54 AM UTC

 
Sorry for the inconvenience.   
  
ListView is used for displaying the list items and we will not maintain the pre-selection in ListView component. When streamline this component to Blazor standard in 2020 Volume 3 release(18.3.35), we have deprecated all the selection related methods(GetSelectedItems, selectItem and SelectMultipleItems).  Refer to the below release notes.    
     
      
We can maintain the selection only by enabling the ShowCheckBox property of ListView component. We can check an item programmatically using checkItem method of ListView. This is the default behavior of ListView component.      
     
If you want to select the list items without using checkbox property, we suggest you to use the ListBox component to achieve your requirement which is similar to ListView component.       
  
Refer to the following links for more details on ListBox component.   
  
      
  
   
Please let us know if you need any further assistance.   
 
Regards,    
Keerthana R.    


Loader.
Up arrow icon