Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
henkkelder opened this issue Dec 13, 2018 · 4 comments · Fixed by #16729
Closed

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

henkkelder opened this issue Dec 13, 2018 · 4 comments · Fixed by #16729
Assignees
Labels
package: angular @ionic/angular package type: bug a confirmed bug report

Comments

@henkkelder
Copy link

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 (cordova-lib@8.1.1)
   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
@ionitron-bot ionitron-bot bot added the triage label Dec 13, 2018
@manucorporat
Copy link
Contributor

was it working in beta.17?

@henkkelder
Copy link
Author

henkkelder commented Dec 13, 2018

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.

@manucorporat
Copy link
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!

@ionitron-bot
Copy link

ionitron-bot bot commented Jan 12, 2019

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jan 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: angular @ionic/angular package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants