Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142881 | Feb 15,2019 04:07 PM UTC | Mar 1,2019 12:20 PM UTC | Angular - EJ 2 | 5 |
![]() |
Tags: ListView |
import { Component, ViewChild, AfterViewInit, ViewEncapsulation } from '@angular/core';
import { EJAngular2Module, ListViewComponent } from 'ej-angular2';
@Component({
selector: 'ej-app',
templateUrl: './app.component.html',
styleUrls: ['app.style.css'],
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
@ViewChild('listInstance')
public listInstance: ListViewComponent;
listdata: object[];
fieldsdata: object;
constructor() {
this.listdata =
[{ "Texts": "Discover Music" },
{ "Texts": "Sales and Events" },
{ "Texts": "Categories" },
{ "Texts": "MP3 Albums" },
{ "Texts": "More in Music" }];
this.fieldsdata = { "text": "Texts" };
}
clicked() {
this.listInstance.widget.setModel({ 'selectedItemIndex': -1 });
}
} |
<ej-listview #listInstance [dataSource]="listdata" [fieldSettings]="fieldsdata" width=100 persistSelection=true></ej-listview>
<br>
<input type="button" value="Un Select" (click)='clicked($event)'> |
Hi Kishore,
Thanks for the update.
In our previous sample, we have provided for EJ1 ListView. For EJ2 ListView, We can deselect an item in listview by removing the "e-active" class from the selected item.
We can utilize “getselectedItems” method for getting selected items from the listview and remove the ‘e-active’ class from that item.
Please refer the below link for sample
https://stackblitz.com/edit/typescript-ck5y3e?file=index.html
Please check it and let us know if you have any concerns.
Thanks,Christo
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.
This page will automatically be redirected to the sign-in page in 10 seconds.