Closed fatb0000 closed 7 years ago
It's already responsive, see: https://github.com/OneWayTech/vue2-datatable/blob/master/lib/index.vue#L10
thanks. I mean like datatables one: https://datatables.net/extensions/responsive/examples/child-rows/column-control.html when the screen size < XXXpx , it will be collapse
Oh i see. Here is an example:
import throttle from 'lodash/throttle'
mounted () {
const $win = $(window)
$win.on('resize', throttle(() => {
let curWidth = $win.width()
let fieldsToHide
if (curWidth < 500) {
fieldsToHide = ['aaa', 'bbb', 'ccc']
} else if (curWidth < 1000) {
fieldsToHide = ['xxx', 'yyy', 'zzz']
} else {
// no fields to hide
}
if (fieldsToHide) {
this.columns.forEach(col => {
if (fieldsToHide.includes(col.field)) {
this.$set(col, 'visible', false)
}
})
}
}, 200))
}
Hi @kenberkeley can you guide me about how responsiveness works and one more thing, https://github.com/OneWayTech/vue2-datatable/blob/master/lib/index.vue#L10 is not working
Thanks
@anit05 This datatable is not responsive...
Hi, Thanks for your quick response for #4 .will respsonive table be supported? Or I can do something to make vue2-datatable responsive?