You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using [VirtualScroll] and virtualtrackby on an ion-list with many ion-items with checkboxes, if some checkboxes are checked and then you scroll to the bottom of the list(about 1000 items), and scroll back up, it seems as if all the items are still checked, but their state is actually unchecked, because an ionChange event does not set it back to checked. Expected behavior:
It seems with virtual scroll it destorys and unchecks the items, but remembers what items were checked. On the destroy it sends an ionChange event that the items are not not checked, or false. It should not send the ionChange event and "uncheck" the item. This causes issues when the list is longer than about 100 items, and any checked items from earlier in the list are essentially "gone". Steps to reproduce:
insert any relevant code here
HTML Code:
<ion-content>
<ion-list [virtualScroll]="companyCheckObject" virtualTrackBy>
<ion-item *virtualItem="let company">
<ion-label> {{company.Company}}</ion-label>
<ion-checkbox [(ngModel)]="company.isChecked" (ionChange)="checkBoxChecked(company.isChecked,company.Company,company.ID)" checked="company.isChecked">
</ion-checkbox>
</ion-item>
</ion-list>
<ion-fab right bottom style="margin-right: 5vw;">
<button ion-fab color="primary" (click)="openUpdateWarranty($event)"><ion-icon name="add"></ion-icon></button>
</ion-fab>
</ion-content>
.ts code
checkBoxChecked(state,companyName,companyId)
{
if(state == true)
{
this.companiesToSend.push({"id" : companyId, "name" : companyName, "isChecked" : true});
}
if(state == false)
{
var index = this.companiesToSend.indexOf(companyId);
this.companiesToSend.splice(index,1);
// console.log(this.companiesToSend);
}
//console.log(this.companiesToSend);
}
**Other information:**
<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->
When using *ngFor instead, it behaves as expected, because the items are not destroyed on scrolling.
**Ionic info:** (run `ionic info` from a terminal/cmd prompt and paste output below):
insert the output from ionic info here
Cordova CLI: 6.5.0
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.6.0
Xcode version: Not installed
The text was updated successfully, but these errors were encountered:
Just as an FYI there is an easy workaround to just use (click) instead of (ionChange). That is probably the proper way and this technically isn't a bug if that is the case. I am kind of new to development so... :)
Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[] 2.x
[X ] 3.x
I'm submitting a ... (check one with "x")
[X] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
When using [VirtualScroll] and virtualtrackby on an ion-list with many ion-items with checkboxes, if some checkboxes are checked and then you scroll to the bottom of the list(about 1000 items), and scroll back up, it seems as if all the items are still checked, but their state is actually unchecked, because an ionChange event does not set it back to checked.
Expected behavior:
It seems with virtual scroll it destorys and unchecks the items, but remembers what items were checked. On the destroy it sends an ionChange event that the items are not not checked, or false. It should not send the ionChange event and "uncheck" the item. This causes issues when the list is longer than about 100 items, and any checked items from earlier in the list are essentially "gone".
Steps to reproduce:
insert the output from ionic info here
The text was updated successfully, but these errors were encountered: