refactor: set selectedIndex = 3 of list-picker (#5008)

* refactor: set selectedIndex = 3 of list-picker

* refactor: list-picker.ts

* refactor: list-picker.xml

* fix: remove ios import
This commit is contained in:
Svetoslav
2017-10-31 14:15:11 +02:00
committed by GitHub
parent b192abf4f2
commit 32b9ec2159
2 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,13 @@
import { ListPicker } from "tns-core-modules/ui/list-picker";
import { Page } from "tns-core-modules/ui/page";
export function loaded(args) { export function loaded(args) {
var items = []; const items = [];
for (var i = 0; i < 100; i++) { for (var i = 0; i < 100; i++) {
items.push("name" + i); items.push("name" + i);
} }
args.object.bindingContext = { items: items };
} const target = (<Page>args.object.page).getViewById<ListPicker>("target");
target.items = items;
target.selectedIndex = 3;
}

View File

@ -1,5 +1,5 @@
<Page loaded="loaded"> <Page loaded="loaded">
<StackLayout> <StackLayout>
<ListPicker items="{{ items }}" style="color: deeppink; background-color:lightskyblue" /> <ListPicker id="target" items="{{ items }}" style="color: deeppink; background-color:lightskyblue" />
</StackLayout> </StackLayout>
</Page> </Page>