Ionic-framework: bug(virtualScroll): checkbox is not updating value on click

Created on 3 Jan 2017  路  6Comments  路  Source: ionic-team/ionic-framework

Hi,

I have a list of transporters and would like to update the attribute 'isSelected' of the virtualItem 'transporter' when I click on it.

But here it doesn't work:

  <div>
    <ion-grid>
      <ion-row [virtualScroll]="transporters" >
        <ion-col *virtualItem="let transporter">
          <ion-card class="transporter" (click)="switchTransporterSelection(transporter)">
            <img src="{{transporter.img}}"/>
            <ion-checkbox checked="{{transporter.isSelected}}"></ion-checkbox>
            {{transporter.isSelected}}
          </ion-card>
        </ion-col>
      </ion-row>
    </ion-grid>
  </div>

And here it works fine:

  <div (click)="switchTransporterSelection(transporters[0])">
    {{transporters[0].key}}
    {{transporters[0].isSelected}}
  </div>
  <div (click)="switchTransporterSelection(transporters[1])">
    {{transporters[1].key}}
    {{transporters[1].isSelected}}
  </div>

What did I missed?

Most helpful comment

This is still happening in ionic 3.20.0.

All 6 comments

thought this was originally because of the layer (which has it's own issues), but appears this happens when using a regular list.

<ion-content>
  <ion-list [virtualScroll]="transporters">
    <ion-item *virtualItem="let transporter">
      <ion-label>{{transporter.name}}</ion-label>
      <ion-checkbox></ion-checkbox>
    </ion-item>
  </ion-list>
</ion-content>

Clicking the ion-checkbox does not toggle the value change. This does not happen with ngFor.

Alright, so interestingly, the checkboxes are updated, just not updated until you scroll

This should be fixed in the latest nightly, could you try it out and let me know if you are still having problems? Thanks!

npm install --save [email protected]

This is still happening in ionic 3.20.0.

Is there any possible fix with this?

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. 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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GeorgeAnanthSoosai picture GeorgeAnanthSoosai  路  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  路  3Comments

alexbainbridge picture alexbainbridge  路  3Comments

giammaleoni picture giammaleoni  路  3Comments

BilelKrichen picture BilelKrichen  路  3Comments