-
Notifications
You must be signed in to change notification settings - Fork 130
/
listview-item-selection-programmatic.component.ts
65 lines (52 loc) · 2.07 KB
/
listview-item-selection-programmatic.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// >> angular-listview-item-selection-programmatic-component
import { Component, OnInit, ViewChild } from "@angular/core";
import { ObservableArray } from "tns-core-modules/data/observable-array";
import { DataItem } from "../dataItem";
import { DataItemService } from "../dataItem.service";
import { RadListViewComponent } from "nativescript-ui-listview/angular";
@Component({
moduleId: module.id,
selector: "tk-listview-item-selection-programmatic",
providers: [DataItemService],
templateUrl: "listview-item-selection-programmatic.component.html",
styleUrls: ["listview-item-selection-programmatic.component.css"]
})
export class ListViewItemSelectionProgrammaticComponent implements OnInit {
private _dataItems: ObservableArray<DataItem>;
private _txtDeselectItemIndex: string;
private _txtSelectItemIndex: string;
constructor(private _dataItemService: DataItemService) {
}
@ViewChild('myRadListView', { read: RadListViewComponent, static: false }) listViewComponent: RadListViewComponent;
get dataItems(): ObservableArray<DataItem> {
return this._dataItems;
}
get txtDeselectItemIndex(): string {
return this._txtDeselectItemIndex;
}
set txtDeselectItemIndex(value: string) {
this._txtDeselectItemIndex = value;
}
get txtSelectItemIndex(): string {
return this._txtSelectItemIndex;
}
set txtSelectItemIndex(value: string) {
this._txtSelectItemIndex = value;
}
ngOnInit() {
this._dataItems = new ObservableArray(this._dataItemService.getNameEmailDataItems());
}
public onSelectItemAtTap() {
this.listViewComponent.listView.selectItemAt(Number(this.txtSelectItemIndex));
}
public onDeselectItemAtTap() {
this.listViewComponent.listView.deselectItemAt(Number(this.txtDeselectItemIndex));
}
public onSelectAllTap() {
this.listViewComponent.listView.selectAll();
}
public onDeselectAllTap() {
this.listViewComponent.listView.deselectAll();
}
}
// << angular-listview-item-selection-programmatic-component