We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ListView Selected Item Loses CSS When ListView Loses Focus

Hi there,

When using ListView the selected item CSS stylying got lost when the user click outside the list (The list loses the focus) we even tested it with your Demo and the issue is there 


How can we maintain the selected item styling when the listview loses the focus


Thanks


4 Replies

LD LeoLavanya Dhanaraj Syncfusion Team November 3, 2022 12:43 PM UTC

Hi Mahmoud,


Greetings from Syncfusion support.


ListView is used for displaying the list items, and we will not maintain the pre-selection in the ListView component. When we streamline this component to the Blazor standard in the 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.   


https://blazor.syncfusion.com/documentation/release-notes/18.3.35/?type=all#listview 


The selection can only be maintained by enabling the ShowCheckBox property of the ListView component. We can check an item programmatically using the checkItem method of ListView. This is the default behaviour of the ListView component.


If you want to select the list items without using the checkbox property, we suggest you use the ListBox component to achieve your requirement, which is similar to the ListView component.


Refer to the following links for more details on ListBox component.  


https://blazor.syncfusion.com/demos/listbox/default-functionalities?theme=bootstrap4 


https://blazor.syncfusion.com/documentation/listbox/getting-started/ 


https://blazor.syncfusion.com/documentation/listbox/selection/    


Regards,

Leo Lavanya Dhanaraj



MA mahmoud November 3, 2022 10:04 PM UTC

Hello,

I have a feature that I need to group items, conditionally select single and multible items, infinite scrolling and load more items when the user scroll to a certain threshold (like the infinite scrolling features on facebook, twitter, linkedin, etc)


Please provide some code samples or recommend the best component to use.


Thanks




MA mahmoud November 10, 2022 02:41 PM UTC



LD LeoLavanya Dhanaraj Syncfusion Team December 9, 2022 04:16 PM UTC


S.No

Query

Solution

1

Group items

Mahmoud, Our Blazor ListView component supports to wrap the nested element into a group based on the category. The category of each list item can be mapped with GroupBy field in the data table, that also supports single-level navigation.

Documentation : https://blazor.syncfusion.com/documentation/listview/grouping

 

2

Conditionally select single and multible items

In our ListView component, the selection can only be maintained by enabling the ShowCheckBox property. We can check an item programmatically using the checkItem method of ListView. This is the default behaviour of the ListView component.

By enabling the ShowCheckBox property and set the value to true, you can be able to select multiple list items in Blazor ListView component.

 

3

Infinite scrolling and load more items when the user scroll to a certain threshold

In Blazor ListView, we have virtualization support which will loads only viewable list items in a view port, which will improve the ListView performance while loading a large amount of data. Check the below link for reference.

https://blazor.syncfusion.com/documentation/listview/virtualization

 


We have also discussed the similar cases in the below mentioned forum. For your reference, we included the forum link.


https://www.syncfusion.com/forums/178258/suitable-component-for-infinite-scrolling-loading-more-and-grouping


Regards,

Leo Lavanya Dhanaraj


Loader.
Live Chat Icon For mobile
Up arrow icon