Skip to content

Fix for "slow" text update after selection in the list #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<GridLayout rows="100, *" columns="*, *" [formGroup]="movieForm" class="yellow-grid">
<Label row="0" col="0" text="Pick a movie:" class="black-label label-center field-name-label"></Label>
<PickerField #picker row="0" col="1" formControlName="movie" hint="select a movie" padding="10" pickerTitle="Pick a movie"
class="picker-field" modalClass="myModal" valueField="year" textField="name" [items]="pickerItems">
class="picker-field" modalClass="myModal" valueField="id" textField="name" [items]="pickerItems">
<ng-template let-item="item">
<GridLayout rows="auto, *" columns="*, auto" class="yellow-grid">
<Label [text]="item.name" colSpan="2" class="black-label item-template-top-label"></Label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ReactiveFormsExampleComponent implements OnInit {
]);

this.movieForm = new FormGroup({
movie: new FormControl(this.pickerItems.getItem(0).year, Validators.required),
movie: new FormControl(this.pickerItems.getItem(0).id, Validators.required),
});
}

Expand Down
14 changes: 7 additions & 7 deletions src/picker.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,20 @@ export class PickerField extends TextField implements TemplatedItemsView {

const context = this;
const callback = (sender: View, selectedIndex: number) => {
if (selectedIndex !== undefined) {
let object = this.getDataItem(selectedIndex);
this.selectedIndex = selectedIndex;

this._updateSelectedValue(object);
}

this.disposeModalView();
};
this._modalRoot.navigate(() => this._page);
this.showModal(this._modalRoot, context, callback, true, this.modalAnimated);
}

private listViewItemTapHandler(args: ItemEventData) {
if (args.index !== undefined) {
let object = this.getDataItem(args.index);
this.selectedIndex = args.index;

this._updateSelectedValue(object);
}

this.closeCallback(args.view, args.index);
}

Expand Down