Closed petesimard closed 6 years ago
Fixed it.
I was setting the source using:
new ObservableArray(row.player.otherPlayers)
Just setting the source to the raw array solved the issue.
Oh good I’m glad you figured it out. Yea, the plugin accepts a raw array, it’s not necessary to use an observable array because there’s no way it can change in front of your eyes. If you need to change the items when it’s displayed, just change the source before you call show. There’s an example in the demo.
When I select an item the args.selectedItem returns undefined unless I use the search box first. If I use the search box (just entering a single letter, and then deleting it) and then select an item, it will correctly set the selectedItem.
<FilterableListpicker #myfilter blur="dark" hintText="Type to filter..." (itemTapped)="otherPlayerSelected($event)"></FilterableListpicker>
otherPlayerSelected(args) { var selectedPlayerName = args.selectedItem; console.log(selectedPlayerName); }
Which platform(s) does your issue occur on?
Android
Please, provide the following version numbers that your issue occurs with:
CLI: (run
tns --version
to fetch it) 3.4.2Cross-platform modules: (check the 'version' attribute in the
node_modules/tns-core-modules/package.json
file in your project) 3.4.1Runtime(s): (look for the
"tns-android"
and"tns-ios"
properties in thepackage.json
file of your project) 3.4.1Plugin(s): (look for the version numbers in the
package.json
file of your project and paste your dependencies and devDependencies here)"dependencies": { "@angular/animations": "~5.2.0", "@angular/common": "~5.2.0", "@angular/compiler": "~5.2.0", "@angular/core": "~5.2.0", "@angular/forms": "~5.2.0", "@angular/http": "~5.2.0", "@angular/platform-browser": "~5.2.0", "@angular/platform-browser-dynamic": "~5.2.0", "@angular/router": "~5.2.0", "nativescript-angular": "~5.2.0", "nativescript-filterable-listpicker": "^2.0.0", "nativescript-theme-core": "~1.0.4", "nativescript-tslib": "^1.8.1-beta.4", "reflect-metadata": "~0.1.8", "rxjs": "~5.5.2", "tns-core-modules": "~3.4.0", "zone.js": "~0.8.18" }, "devDependencies": { "babel-traverse": "6.4.5", "babel-types": "6.4.5", "babylon": "6.4.5", "lazy": "1.0.11", "nativescript-dev-typescript": "~0.6.0", "typescript": "~2.6.2" }
Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it. Show a list and select an item right away, the selectedItem property will be undefined. If you use the search box, the selectedItem will be correct.