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

    q-table merge 2 fields into a single column

    Framework
    2
    5
    1465
    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.
    • S
      stuffy last edited by

      Is it possible to merge data from 2 fields in to a single column. The data is fetched from Db ans its there in row.

      1 Reply Last reply Reply Quote 0
      • S
        stuffy last edited by stuffy

        Does someone have any suggestions?

        Can we have a row object in format fn so that we can merge multiple fields?

        1 Reply Last reply Reply Quote 0
        • S
          stuffy last edited by

          using scoped slots

                <q-td auto-width slot="body-cell-user" slot-scope="props" :props="props">
                  <div>[{{ props.row["userid"] }}] {{ props.row["lastname"] }}/ {{ props.row["companyname"] }}</div>
                </q-td>
          
          1 Reply Last reply Reply Quote 0
          • metalsadman
            metalsadman last edited by

            @stuffy you can also do it in your columns array…
            ie.

            columns: [ // array of Objects
              // column Object definition
              {
                name: 'user',
                ...
                field: row => row.userid + ' ' + row.lastname + ' / ' + row.companyname, // can do here or at format
            
                // (optional) you can format the data with a function
                format: (val, row) => `${row.userid} ${row.lastname} \ / ${row.companyname}`, // can also do here
              },
            ...
            
            1 Reply Last reply Reply Quote 0
            • S
              stuffy last edited by

              @metalsadman This makes it easier. Thank you very much.

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