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

    How to set fixed column widths in Q-Table

    Help
    4
    5
    3785
    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.
    • J
      jrhopkins83 last edited by

      I’m trying to set fixed column widths in the column definition for a Q-Table.
      For example:
      1st column = 20px
      2nd column = 20px
      3rd column = 10px
      4th column = 5px
      ett.

      I read a couple of older posts that suggested adding style:‘width: NNpx’ in the columns definition in data. However that doesn’t work and I haven’t found any other solutions. Example:

      template:
      <q-table
      class=“my-sticky-header-column-table”
      table-class=“table-class”
      :data=“filteredScores”
      :columns=“columns”
      virtual-scroll
      hide-bottom
      :pagination.sync=“pagination”
      :rows-per-page-options="[0]"
      row-key=“id”
      :visible-columns=“visibleColumns”
      />

        columns: [
          {
            name: 'last',
            required: true,
            label: 'Last Name',
            align: 'left',
            field: 'lastName',
            sortable: true,
            style: 'width: 20px'
          },
      1 Reply Last reply Reply Quote 0
      • T
        thescript last edited by

        Hi @jrhopkins83 , have you been able to solve this problem?

        1 Reply Last reply Reply Quote 0
        • Q
          QuaSam last edited by

          By trial and error this seems to be working (let me know if not and I will revise this post): (It would be nice to have a few examples in Q-Table docs. It may be standard CSS but it is not always clear when CSS parameters apply and when they do not. Q-Table is a great display mechanism.)
          style: “max-width: 500px; min-width: 500px”

          metalsadman 1 Reply Last reply Reply Quote 0
          • metalsadman
            metalsadman @QuaSam last edited by

            @QuaSam https://forum.quasar-framework.org/topic/6290/q-table-custom-column-width-via-column-style-property/2

            Q 1 Reply Last reply Reply Quote 1
            • Q
              QuaSam @metalsadman last edited by

              @metalsadman Thanks! Once again, careful reading of the docs can save a lot of time.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post