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

    [Solved] DataTable display a column with icon

    Framework
    3
    4
    842
    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
      Stanley last edited by Stanley

      Is that possible that DataTable display a column with icon only?

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        Yes. Use a scoped slot for that column.

        1 Reply Last reply Reply Quote 0
        • Hawkeye64
          Hawkeye64 last edited by

          Here is my column with icon:

                    <q-icon :name="getDownloadStatusIcon(props)" />
                  </q-td>
          

          And the function:

              getDownloadStatusIcon: function (props) {
                let downloaded = props.row.downloaded
                let snapshots = true
                if (!downloaded) {
                  // check with attachments
                  props.row.attachments.forEach((attachment) => {
                    if (!attachment.snapshotName) {
                      snapshots = false
                    }
                  })
                }
                if (!downloaded && !snapshots) {
                  return 'fas fa-spinner fa-lg fa-spin'
                }
                else if (!downloaded && snapshots) {
                  return 'fas fa-image fa-lg'
                }
                else {
                  return 'fas fa-video fa-lg'
                }
              },
          

          Hope it helps!

          S 1 Reply Last reply Reply Quote 0
          • S
            Stanley @Hawkeye64 last edited by

            @hawkeye64 Thank you! It works now.

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