Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Row custom style #186

Open
SubhaChandraDas opened this issue Jul 20, 2020 · 1 comment
Open

Row custom style #186

SubhaChandraDas opened this issue Jul 20, 2020 · 1 comment

Comments

@SubhaChandraDas
Copy link

Hi, Can you share me some idea about custom styling of a particular row after loading all data on data-table. I want to apply row style on a particular row which met some specific condition. It will be a great help! Thanks in advance.

@dgaus
Copy link

dgaus commented Sep 4, 2020

I resorted to doing something like this, though it's not reactive, it does work.

  computed: {
    isCompleted() {
      return this.row["completed"]
    }
  },

  methods: {
    updateRowColor(value) {
      if (value) {
        this.$el.closest('tr').classList.add('success')
      } else {
        this.$el.closest('tr').classList.remove('success')
      }
    }
  },

  mounted() {
    this.updateRowColor(this.row[this.field])
  },

  watch: {
    isCompleted(value) {
      this.updateRowColor(value)
    }
  },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants