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

    q-infinite-scroll with nested row / columns

    Framework
    1
    2
    517
    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.
    • S
      steve last edited by steve

      I have a single row with numerous cols containing q-cards displayed on my page. The column classes (col-sm-6 col-md-4) evenly distribute all the cards based upon the layout of the screen.

      I want to utilize QInfiniteScroll, however it expects the first element to have the v-for loop. Since my row does not, I have to put it outside the q-infinite-scroll element. Now because of this, the css is not right to pick up and handled the nested columns.

      It would be nice if there was a content-class on q-infinite-scroll so that I can apply ‘row’ on the inner ‘q-infinite-scroll-content’ div. Any other ideas on how to get this to work?

      <div class="row gutter-sm"><!-- Where should this be applied? It won't work here or inside or on the q-infinite-scroll -->
      <q-infinite-scroll :handler="loadMore" ref="cardScroll">
        <div v-for="(card, index) in cards" :key="index" inline class="col-sm-6 col-md-4">
            <q-card >this is a card</q-card>
         </div>
      </q-infinite-scroll>
      </div>
      S 1 Reply Last reply Reply Quote 0
      • S
        steve @steve last edited by

        I’ve modified the source of QInfiniteScroll.js to include a contentClasses prop so that a css class can be applied to the inner q-infinite-scroll-content div. From what I see, no other css was being applied to that element.

        If this looks like something you want merged, I can create a PR.

        QInfiniteScroll.js

        export default {
          name: 'QInfiniteScroll',
            props: {
              handler: {
                type: Function,
                required: true
              },
              inline: Boolean,
              offset: {
                type: Number,
                default: 0
              },
              contentClasses: [Object, Array, String]
        

        …

        render (h) {
            return h('div', { staticClass: 'q-infinite-scroll' }, [
              h('div', {
                ref: 'content',
                staticClass: 'q-infinite-scroll-content',
                'class': this.contentClasses
              }, this.$slots.default),
              this.fetching
                ? h('div', { staticClass: 'q-infinite-scroll-message' }, this.$slots.message)
                : null
            ])
          }
        

        Then I was able to do this:

         <q-infinite-scroll :handler="loadMore" ref="cardScroll" content-classes="row gutter-sm">
          <div v-for="(card, index) in cards" :key="index" inline class="col-sm-6 col-md-4">
              <q-card >this is a card</q-card>
           </div>
        </q-infinite-scroll>
        1 Reply Last reply Reply Quote 0
        • First post
          Last post