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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to disable key press in Angular's ListView

Thread ID:





150042 Dec 18,2019 02:31 PM UTC Dec 19,2019 11:35 AM UTC Angular - EJ 2 1
Tags: ListView
Alireza Kahaei
Asked On December 18, 2019 02:31 PM UTC

you have mentioned that you support the keypress on Angular's ListViewhere. How can I disable the support of keypress altogether while still having the background color of the item selected darker than the other items?
The background color of the item selected is changed with the following CSS:

Shameer Ali Baig Sulaiman Ali Baig [Syncfusion]
Replied On December 19, 2019 11:35 AM UTC

Hi Alireza, 
Greetings from Syncfusion support. 
Solution for Query 1(Prevent keyboard interaction):  
We have checked your reported query to prevent the keyboard action in EJ2 ListView component. You can prevent this key action by binding the keydown() event for ListView component. 
Refer the below code sample. 
 <ejs-listview id='sample-list-flat' [dataSource]='data' (keydown)="keydown($event)"></ejs-listview> 
keydown(event) { 
Query 2(Change the color of selected items): 
Yes, you can change the color of selected items using referred CSS Styles. In ListView component, ‘e-active’ class will be available in the selected items. Using this class, you can change the color based on your requirement. 
Refer the below code sample. 
  .e-listview .e-list-item.e-active { 
    background-color: blue; 
Refer the below sample link for your reference. 
Please let us know, if you need any further assistance. 
Shameer Ali Baig S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon