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

    How to use infinite scroll in quasar to load more datas?

    Framework
    2
    2
    1745
    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.
    • V
      vltetea last edited by

      I am trying to load more data using quasar infinite scroll but i cannot load any more data infact it loads all the data once… and i got

      done() is not a function
      

      Below is my method for infinite scroll

      initDefaultData (done, index) {
        setTimeout (() => {
          if (this.datas) {
            db.collection('example').orderBy('created_at', 'desc').get().then(res => {
              if (res.size < 1) {
                this.noData = true
              } else {
                res.forEach((doc) => {
                  this.datas.push({
                    id: doc.id
                  })
                })
              }
            })
            done()
          }
        }, 1000)
      }
      

      Here is where i use infinite scroll in template

      <q-infinite-scroll @load="initDefaultData">
        <q-card v-for="(data, index) in datas" :key="index" class="q-mb-md q-mt-sm">
        </q-card>
      </q-infinite-scroll>
      
      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @vltetea last edited by dobbel

        @vltetea

        You have to put the args in the @load

        <q-infinite-scroll @load="initDefaultData(index,done)">
          <q-card v-for="(data, index) in datas" :key="index" class="q-mb-md q-mt-sm">
          </q-card>
        </q-infinite-scroll>
        

        Or with arrows:

        <q-infinite-scroll @load="(index,done) => initDefaultData(index,done)">
          <q-card v-for="(data, index) in datas" :key="index" class="q-mb-md q-mt-sm">
          </q-card>
        </q-infinite-scroll>
        

        BTW: virtual scroll is better suited for infinite scrolling like q-virtual-scroll.

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