Skip to content

[4.0.0-beta.18] Virtualscroll gives "template for virtual item was not provided" #16725

Closed

Description

@henkkelder

Bug Report

Ionic version:
[x] 4.x

Current behavior:
Error in console: Error: template for virtual item was not provided. No items or headers are shown.

Expected behavior:
Should show header and items.

Steps to reproduce:

Related code:

<ion-content>
    <ion-virtual-scroll *ngIf="hasLoaded" [items]="programmaOnderdelen" [headerFn]="HeaderFn" approxItemHeight="68px" approxHeaderHeight="30px">
        <ion-item-divider *virtualHeader="let header">
            {{ header }}
        </ion-item-divider>
        <ion-item *virtualItem="let po" href="#" (click)=" onHeaderClick(po)" lines="none" >
            <ion-avatar category-menu={{po.categorie}}>
                <img [src]="po.cat.pict" />
            </ion-avatar>
            <ion-label>
                <div class="topline" [ngStyle]="{color : po.sublocatie.hoofdlocatie.bcolor}">
                    <span>{{po.aanvangsDt * 1000 | date: "EEE H:mm" }}</span>
                    <span *ngIf="po.eindDt"> - {{po.eindDt * 1000 | date: "H:mm" }}</span>
                    <span style="padding-left:10px;">{{po.sublocatie.hoofdlocatie.naam}}</span>
                </div>
                <div class="titleline">
                    <span class="title">{{po.titel}}</span>
                </div>
            </ion-label>
        </ion-item>
    </ion-virtual-scroll>
</ion-content>

Other information:
In virtual-scroll.js, routine getComponent expects a numeric argument 'type'. But it is called with a string argument being 'item', 'header' or 'footer'. This results in an exception being thrown a line 41.

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.5.0 (C:\Users\henkkelder\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.18
   @angular-devkit/build-angular : 0.10.7
   @angular-devkit/schematics    : 7.1.3
   @angular/cli                  : 7.1.3
   @ionic/angular-toolkit        : 1.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : android 7.1.2, browser 5.0.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.5, (and 18 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\henkkelder\AppData\Local\Android\Sdk)
   NodeJS            : v8.11.4 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10

Activity

  1. manucorporat commented on Dec 13, 2018

    @manucorporat
    Contributor

    was it working in beta.17?

  2. henkkelder commented on Dec 13, 2018

    @henkkelder
    Author

    Yes it was.
    Although on IOS the virtualScroller needed a 'manual scroll' to show anything. On Android it worked with some minor glitches.

    I have modified getComponent on my own system so the switch checks for the stringvalues and then it works again. I cannot find why the cell.type changed from numeric value to string.

  3. manucorporat commented on Dec 13, 2018

    @manucorporat
    Contributor

    @henkkelder you are right! it's a bug, i am working in a fix a new tests for angular.
    Thanks for the issue report!

  4. self-assigned this
    on Dec 13, 2018
  5. added
    type: bug
    package: angular
    on Dec 13, 2018
  6. added a commit that references this issue on Dec 13, 2018
    392c219
  7. added a commit that references this issue on Dec 13, 2018
    f05c7d6
  8. ionitron-bot commented on Jan 12, 2019

    @ionitron-bot

    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.

  9. locked and limited conversation to collaborators on Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

package: angulartype: bug

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions