cscan / vue-excel-editor

Vue2 plugin for displaying and editing the array-of-object in Excel style
MIT License
557 stars 108 forks source link

How do i get the rows? #115

Closed p0sidonz closed 2 years ago

p0sidonz commented 2 years ago

I have a simple jsondata file which i am showing, I have to sum every rows horizontally. But how do i get the each object so that i can add my logic to the 'TOTAL' column for each rows? total

cscan commented 2 years ago

You may try this alternative way to define the jsondata:

data () {
   return {
      jsondata: [{
         employeeId: 123,
         name: 'John wick',
         daysWorked: 30
         perDayWages: 3000,
         get total () {
            return this.daysWorked * this.perDayWages
         }
      }, {
         employeeId: 124,
         name: 'kratos',
         daysWorked: 15
         perDayWages: 3000,
         get total () {
            return this.daysWorked * this.perDayWages
         }
      }]
   }
}
p0sidonz commented 2 years ago

Oh! Never thought of doing this. Thank you very much! <3