question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Infinite scroll event can't be enabled once disabled

See original GitHub issue

Bug Report

Ionic version:

[x] 4.x

Current behavior:

According to Docs, we can enable infinite scroll event once it’s disabled by toggling as specified here https://ionicframework.com/docs/api/infinite-scroll/ ( this part of code:- this.infiniteScroll.disabled = !this.infiniteScroll.disabled; ) But when I am trying to enable it again, it’s not happening, tried printing this.infiniteScroll.disabled and this.infiniteScroll to console, the “disabled” property’s value is differing once it has been made true.

Tried making it false, but it’s not happening.

Expected behavior:

Once “disabled” property has been made false, infinite scroll event should start working again, and when scrolled downside should perform it’s default behaviour of showing new items in the list.

Steps to reproduce:

Describing the steps according to what we faced:

  1. Searched for a particular filter, got the list, infinite scroll works perfectly.
  2. When the whole list is retrieved, scroll event been made true (infinite scroll event is disabled by event.target.disabled = true)
  3. Searching for another filter, got the list which is not complete. This time since scroll event is diabled it won’t work so we tried making it false (enabling the event listener) using this.infiniteScroll.disabled = false but did not work.

Related code:

export class InfiniteScrollExample {
  @ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;

  constructor() {}

  loadData(event) {
    setTimeout(() => {
      console.log('Done');
      event.target.complete();

      // App logic to determine if all data is loaded
      // and disable the infinite scroll
      if (data.length == 1000) {
        event.target.disabled = true;         <------------ (a)
      }
    }, 500);
  }

  toggleInfiniteScroll() {
    this.infiniteScroll.disabled = !this.infiniteScroll.disabled;
  }
}

this.infiniteScroll.disabled = !this.infiniteScroll.disabled; <----- Not working.

try this: (b) console.log(this.infiniteScroll); © console.log(this.infiniteScroll.disabled);

the disabled property in both consoles (b) & © will differ once it’s made true (a).

Other information:

Suggestion on how to fix: Make this working - this.infiniteScroll.disabled = false; indeed (event.target.disabled = false) once it has been made true.

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.10.0 (C:\Users\User28\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0
   @angular-devkit/build-angular : 0.8.9
   @angular-devkit/schematics    : 7.2.3
   @angular/cli                  : 7.2.3
   @ionic/angular-toolkit        : 1.3.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Feb 26, 2019

Hello @liamdebeasi, I have created a demo repo which has the code to show the issue. Given demo credentials so that you can access and check out the issue. Here is the link

https://github.com/Yaseen-Nadaf/medx-demo

Also please try it on a desktop because it was working fine on a laptop sometimes but not on a desktop.

0reactions
ionitron-bot[bot]commented, Apr 3, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Infininte scroll not working after disabled then enable again
I am using ionic 5 and i am using ion-refresher and ion-infinite-scroll in one page. when i tried to scroll new set of...
Read more >
Options
Enables a button to load pages on click. The button state is changed by Infinite Scroll events: Disabled while loading on request; Re-enabled...
Read more >
angular - Ionic 4 Infinite Scroll
I am trying to load dynamic data using infinite scroll, but the event does not fire when I get to the bottom page....
Read more >
How to enable/disable infinite scrolling ...
I have configured a Search page using the Sitecore Javascript Search Framework and where infinite scrolling is enabled for the ...
Read more >
Infinite scroll search-friendly recommendations
With infinite scroll, crawlers cannot always emulate manual user ... page content into component pages that can be accessed when JavaScript is disabled....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found