No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    [Solved]Infinite Scroll @load="onLoad" keeps getting called when used inside Tab Panels.

    Help
    4
    7
    2007
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      Zackery747 last edited by Zackery747

      Hello, I’m trying to use an infinite scroll inside tab panels. The main issues is the @load event to load more data. This event is being called infinite times after each other when placed inside the tab panels. It doesn’t wait for the user to scroll down and then load more data.

      any suggestions to solve this issue will be much appreciated.

      link to code pen: link text

          <q-tab-panels v-model="tabIndex" animated swipeable keep-alive>
            <q-tab-panel swipeable name="tab1" style="background: #17202A;">
              <q-infinite-scroll @load="onLoad" :offset="250">
                <div v-for="(item, index) in items" :key="index" class="caption">
                  <p>Lorem ipsum dolor sit amet consectetur labore.</p>
                </div>
                <template v-slot:loading>
                  <div class="row justify-center q-my-md">
                    <q-spinner-dots color="primary" size="40px" ></q-spinner-dots>
                  </div>
                </template>
              </q-infinite-scroll>
            </q-tab-panel>
          </q-tab-panels>
      ```**bolded text**
      metalsadman 1 Reply Last reply Reply Quote 0
      • metalsadman
        metalsadman @Zackery747 last edited by

        @Zackery747 you must set a height on your container, as mentioned here https://quasar.dev/vue-components/infinite-scroll#Usage

        example : https://codepen.io/metalsadman/pen/KKKJKoK?editors=1111

        Z 2 Replies Last reply Reply Quote 0
        • Z
          Zackery747 @metalsadman last edited by

          @metalsadman Thank you for bringing that to my attention. It works perfectly now! 😁 👊 🤜

          1 Reply Last reply Reply Quote 0
          • Z
            Zackery747 @metalsadman last edited by Zackery747

            @metalsadman Really Dumb Question. What must I do if the onLoad method returns an empty list of data? Because I’m using the onLoad method to get data from a server. But when I return an empty list of data it just keeps loading and making calls one after another.

            Basic mimic of what is happening : code pen example

            Z 1 Reply Last reply Reply Quote 0
            • Z
              Zackery747 @Zackery747 last edited by

              @Zackery747 Found a solution. You only have to call this.$refs.infiniteScroll.stop() when the return data list is empty. 🤦🏻♂ 🙈

              1 Reply Last reply Reply Quote 0
              • J
                jehadjaghoub last edited by

                Simply scroll-target=“body” on your eg : <q-infinite-scroll scroll-target=“body” … />

                1 Reply Last reply Reply Quote 1
                • K
                  katrine.hom last edited by

                  @jehadjaghoub Thanks for the answer, it really helped me!

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post