Skip to content

Commit

Permalink
manually reset scroll position to 0 on list update and refresh. Fix #55
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuNls committed Jul 28, 2016
1 parent 854f7ba commit 2d6d74a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/pages/dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>{{ 'no-watch' | translate:{value: param} }}</h1>
</ion-refresher-content>
</ion-refresher>

<ion-list *ngIf="user && user.watches.length != 0" >
<ion-list id="dash-list" *ngIf="user && user.watches.length != 0">
<ion-item-sliding #slidingItem *ngFor="let watch of user.watches">

<ion-item>
Expand Down
10 changes: 8 additions & 2 deletions app/pages/dashboard/dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, ElementRef, EventEmitter, ViewChild} from '@angular/core';
import {Component, ElementRef, EventEmitter} from '@angular/core';
import {Alert, Nav, Loading, NavController, NavParams, ActionSheet, ItemSliding} from 'ionic-angular';
import {LoginComponent} from 'tw-common/dist/app/directives/login/login.component';
import {TwAPIService} from 'tw-common/dist/app/services/twapi.service';
Expand All @@ -20,7 +20,7 @@ import {ArethmeticSign} from 'tw-common/dist/app/pipes/arethmetic-sign.pipe';
directives: [Footer, Header]
})
export class DashboardPage {

user:User;
WatchStatus = WatchStatus;
MeasureStatus = MeasureStatus;
Expand All @@ -39,13 +39,18 @@ export class DashboardPage {
DashboardPage.userChanged.subscribe(
user => {
this.user = user;
this.resetScroll();
console.log("user", this.user);
}
);

this.user = this.navParams.get('user');
}

resetScroll(){
this.elementRef.nativeElement.querySelector('#dash-list').scrollTop = 0;
}

updateWatch(watch:Watch, slidingItem: ItemSliding){
console.log(watch);
this.nav.push(WatchPage, {
Expand Down Expand Up @@ -138,6 +143,7 @@ export class DashboardPage {
this.twapi.getWatches().then(
res => {
this.user.watches = res;
this.resetScroll();
refresher.complete();
}
)
Expand Down
2 changes: 1 addition & 1 deletion app/pages/header/header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<i style="z-index: 10; display: block; position:absolute; top:30px; color: white;">v0.6.25</i>
<i style="z-index: 10; display: block; position:absolute; top:30px; color: white;">v0.6.42</i>
<ion-icon (click)="onBack()" *ngIf="back" class="header left" name="md-arrow-back"></ion-icon>
<ion-icon (click)="onChat()" *ngIf="chat" class="header right" name="ios-chatbubbles"></ion-icon>

Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="Toolwatch.Toolwatch" version="0.6.25" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="Toolwatch.Toolwatch" version="0.6.42" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Toolwatch</name>
<description>Measure the precision of your mechanical watches</description>
<author email="[email protected]" href="https://toolwatch.io/">Mathieu Nayrolles</author>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
],
"cordovaPlatforms": [],
"name": "Toolwatch",
"version": "0.6.25",
"version": "0.6.42",
"description": "Measure the precision of your mechanical watches"
}

0 comments on commit 2d6d74a

Please sign in to comment.