Vuetable-2: Apply css to table specific row (and td)

Created on 6 Nov 2017  路  1Comment  路  Source: ratiw/vuetable-2

Hi
Can i apply a css class to a row identified with selectedTo?
Es.
rowCss (check) {
if(check===true) {
console.log(this.$refs.vuetable.selectedTo)
this.$refs.vuetable.selectedTo.rowClass='bg-blu' //something like this
}
},
onToggledChbox(chk,dataItem) {
this.rowCss(chk)
}

And is it possible to identify a specific td inside a selected row?
Tnks

Most helpful comment

You should be able to use row-class prop to do that.

  <vuetable ref="vuetable"
    :row-class="onRowClass"
  ></vuetable>


  //...
  methods: {
    onRowClass(dataItem, index) {
      // put your logic here
      // to reference selectedTo, use `this.$refs.vuetable.selectedTo`
      // and return the CSS class name you want

      return this.$refs.vuetable.selectedTo.indexOf(dataItem.id) > -1
        ? 'bg-blu'
        : 'bg-white'
    }
  }

>All comments

You should be able to use row-class prop to do that.

  <vuetable ref="vuetable"
    :row-class="onRowClass"
  ></vuetable>


  //...
  methods: {
    onRowClass(dataItem, index) {
      // put your logic here
      // to reference selectedTo, use `this.$refs.vuetable.selectedTo`
      // and return the CSS class name you want

      return this.$refs.vuetable.selectedTo.indexOf(dataItem.id) > -1
        ? 'bg-blu'
        : 'bg-white'
    }
  }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

wa05 picture wa05  路  3Comments

flyingcoder picture flyingcoder  路  3Comments

legreco picture legreco  路  5Comments

hjJunior picture hjJunior  路  3Comments

mannyyang picture mannyyang  路  3Comments