Should I use :columns in a q-table when using slots?
-
I use a
q-table
with<template v-slot:body="props">
and then
q-tr
to build my columns.Since everything is handled via
q-tr
, should I still have a:columns
entry inq-table
? I have a feeling that it is redundant in that case (?) -
@wpq said in Should I use :columns in a q-table when using slots?:
should I still have a :columns entry in q-table
Yes because
columns
is used for the table header.See this example:
https://quasar.dev/vue-components/table#Body-slots -
@dobbel said in Should I use :columns in a q-table when using slots?:
@wpq said in Should I use :columns in a q-table when using slots?:
should I still have a :columns entry in q-table
Yes because
columns
is used for the table header.See this example:
https://quasar.dev/vue-components/table#Body-slotsYes, I use body slots with
:columns
today. What I do not understand is why keeping the same information in both places. After all, I am building the table column after column anyway.If this is a design solution then fine, I wanted to make sure that there is not a way to get rid of
:columns
and configure them inq-tr
which I use anyway. -
@wpq said in Should I use :columns in a q-table when using slots?:
body slots
body slot != header slot
a table’s header uses a different set of html elements (
th
thead
/ quasar components (q-th
) then the body part of a table.See:
https://quasar.dev/vue-components/table#QTh-APIA standard html table:
<table> <thead> <tr> <th>Month</th> <th>Savings</th> </tr> </thead> <tbody> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </tbody> <tfoot> <tr> <td>Sum</td> <td>$180</td> </tr> </tfoot> </table>