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

    Should I use :columns in a q-table when using slots?

    Help
    2
    4
    1152
    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.
    • W
      wpq last edited by wpq

      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 in q-table? I have a feeling that it is redundant in that case (?)

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @wpq last edited by

        @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

        W 1 Reply Last reply Reply Quote 0
        • W
          wpq @dobbel last edited by

          @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-slots

          Yes, 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 in q-tr which I use anyway.

          dobbel 1 Reply Last reply Reply Quote 0
          • dobbel
            dobbel @wpq last edited by dobbel

            @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-API

            A 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>
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post