vue2-datatable icon indicating copy to clipboard operation
vue2-datatable copied to clipboard

Row custom style

Open SubhaChandraDas opened this issue 5 years ago • 1 comments

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.

SubhaChandraDas avatar Jul 20 '20 13:07 SubhaChandraDas

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)
    }
  },

dgaus avatar Sep 04 '20 15:09 dgaus