-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(virtual-scroll): redraw empty list when updated with no records
Closes #6512
- Loading branch information
1 parent
af0ac6d
commit 288df86
Showing
5 changed files
with
139 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Component, NgModule } from '@angular/core'; | ||
import { IonicApp, IonicModule } from '../../../..'; | ||
|
||
|
||
@Component({ | ||
templateUrl: 'main.html' | ||
}) | ||
export class E2EPage { | ||
items: Array<{title: string, date: string}>; | ||
|
||
constructor() { | ||
this.emptyList(); | ||
} | ||
|
||
fillList() { | ||
this.items = []; | ||
for (let i = 0; i < 59; i++) { | ||
this.items.push({ | ||
title: 'Item ' + i, | ||
date: '23:' + (59 - i) | ||
}); | ||
} | ||
} | ||
|
||
emptyList() { | ||
this.items = []; | ||
} | ||
|
||
itemTapped(ev: any, item: {title: string, date: string}) { | ||
console.log(`itemTapped: ${item.title}`); | ||
} | ||
|
||
reload() { | ||
window.location.reload(true); | ||
} | ||
|
||
} | ||
|
||
|
||
@Component({ | ||
template: '<ion-nav [root]="root"></ion-nav>' | ||
}) | ||
export class E2EApp { | ||
root = E2EPage; | ||
} | ||
|
||
|
||
@NgModule({ | ||
declarations: [ | ||
E2EApp, | ||
E2EPage | ||
], | ||
imports: [ | ||
IonicModule.forRoot(E2EApp) | ||
], | ||
bootstrap: [IonicApp], | ||
entryComponents: [ | ||
E2EApp, | ||
E2EPage | ||
] | ||
}) | ||
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<ion-header> | ||
<ion-navbar> | ||
<ion-title>Virtual Scroll: List</ion-title> | ||
<ion-buttons end> | ||
<button ion-button (click)="reload()"> | ||
Reload | ||
</button> | ||
</ion-buttons> | ||
</ion-navbar> | ||
</ion-header> | ||
|
||
|
||
<ion-content> | ||
|
||
<div padding> | ||
<button ion-button (click)="fillList()">Fill List</button> | ||
<button ion-button (click)="emptyList()">Empty List</button> | ||
</div> | ||
|
||
<ion-list [virtualScroll]="items"> | ||
|
||
<ion-item text-wrap *virtualItem="let item" (click)="itemTapped($event, item)"> | ||
|
||
<ion-row class="item-row"> | ||
<ion-col class="item-title" width-80> | ||
{{item.title}} | ||
</ion-col> | ||
<ion-col class="item-time" width-20> | ||
{{item.date}} | ||
</ion-col> | ||
</ion-row> | ||
|
||
</ion-item> | ||
|
||
</ion-list> | ||
|
||
</ion-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters