quasar icon indicating copy to clipboard operation
quasar copied to clipboard

QTable - animation for expanding/closing row

Open m0jimo opened this issue 5 years ago • 13 comments

Is your feature request related to a problem? Please describe. I use q-table with expanding rows. I think that from UI perspective is better to have a row expanded with animation rather than quick show/hide. It is easy to do it with div table but I haven't found a way for table/td/tr.

Describe the solution you'd like Add property/class which will animate expanding row.

Describe alternatives you've considered If it is not suitable to be part of q-table it'd be nice to have a link to a how-to where could be piece of code how to manage it.

Additional context Expanding rows example from the documentation page.

m0jimo avatar Jun 14 '19 09:06 m0jimo

I second the notion! Also if we can add to this request.. an "expand all" option?

rfox12 avatar Sep 12 '19 22:09 rfox12

An upvote from me also :)

trondulseth avatar Oct 04 '19 16:10 trondulseth

Suitable also for adding, removing rows dynamically 👍

luckylooke avatar Dec 11 '19 16:12 luckylooke

And the ability to have a single row open at a time...

Batsirai avatar Dec 23 '19 22:12 Batsirai

And the ability to have a single row open at a time...

Im using an example in docs for expanding a row for qtable. If it doesn't fit to your need You can open a new issue.

m0jimo avatar Dec 24 '19 01:12 m0jimo

Definitely need to animate the expanding. Also useful to have a single row open at a time!

apavel3458 avatar Jan 03 '20 03:01 apavel3458

I have tried to use QSlideTransition in Qtable, but it does not work

Does anyone know how to use it in Qtable?

ecmap avatar Aug 21 '20 05:08 ecmap

I have many tables with expansion rows, i need some animation to open or close the row, something like q-expansion-item but for q-table

davidparraz41 avatar Nov 18 '20 12:11 davidparraz41

I use the following to animate the QTable height (can probably work for any component I would think).

SlideTransition.vue

<template>
  <div ref="container" style="transition: height 0.4s; overflow: hidden;">
    <div ref="content">
      <slot></slot>
    </div>
  </div>
</template>

<script>
import { defineComponent, onMounted, onUnmounted, ref } from 'vue'

export default defineComponent({
  setup() {
    const content = ref()
    const container = ref()
    const resizeObserver = new ResizeObserver(() => {
      container.value.style.height = content.value.scrollHeight + 'px'
    })

    onMounted(() => {
      resizeObserver.observe(content.value)
    })
    onUnmounted(() => {
      resizeObserver.disconnect()
    })

    return {
      container,
      content,
    }
  },
})
</script>

Example usage

<template>
  <SlideTransition>
    <q-table></q-table>
  </SlideTransition>
</template>

philfontaine avatar Sep 21 '21 15:09 philfontaine

I would prefer if the animation of the qTable-expansion-row was included in the default of Quasar and would work like the qExpansionItem.

hendrik-schneider avatar May 05 '22 14:05 hendrik-schneider

Is there an update here? This is a frequently requested feature and would fit in well with the "Quasar style" if there was a smooth open and close animation. Maybe incomming with Quasar 3?

namespace-github avatar Aug 08 '22 15:08 namespace-github

Since I'm literally working on coding this atm, it would be great to upvote this as a standard part of q-table!

brakop avatar Aug 26 '22 02:08 brakop

Also, suggestion for anyone else working on this, don't try to transition the TR, just transition a div or divs within it: <q-tr style="height:0px;padding:0px;"> <q-td :colspan="props.cols.length" style="height:0px;padding:0px;" > <transition name="fadeHeight"> <div v-if="FridgesSelected" > This is the magic row you want to display/hide </div> </transition> </q-td> </q-tr> </q-table>

<style> .fadeHeight-enter-active, .fadeHeight-leave-active { transition: all 0.5s; max-height: 230px; } .fadeHeight-enter-from , .fadeHeight-leave-to { opacity: 0; max-height: 1px; } </style>

brakop avatar Aug 26 '22 03:08 brakop