Row adding, some webpack tweaks
This commit is contained in:
+17
-5
@@ -4,7 +4,7 @@
|
||||
<tr>
|
||||
<th style="width:3rem" class="border-top-0"></th>
|
||||
<th style="width:3rem" class="border-top-0"></th>
|
||||
<th v-for="col in columns" :class="colClasses(col)">{{col.title}}</th>
|
||||
<th v-for="col in columns" :class="colClasses(col)" :title="col.name">{{col.title}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -59,6 +59,7 @@ export default {
|
||||
route: String,
|
||||
xRows: Object, // key'd by _id
|
||||
columns: Array,
|
||||
lastPage: Boolean,
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
@@ -83,13 +84,22 @@ export default {
|
||||
},
|
||||
|
||||
toggleRowDelete(_id) {
|
||||
if (!_.isDefined(this.rows[_id])) return;
|
||||
|
||||
let remove = !this.rows[_id]._remove
|
||||
|
||||
this.query({
|
||||
action: remove ? 'row.remove' : 'row.restore',
|
||||
id: _id
|
||||
}, (resp) => {
|
||||
this.$set(this.rows, _id, resp.data)
|
||||
// if response is null, this was a New row
|
||||
// and it was discarded without a way back - hard drop
|
||||
if (_.isEmpty(resp.data)) {
|
||||
this.$delete(this.rows, _id)
|
||||
}
|
||||
else {
|
||||
this.$set(this.rows, _id, resp.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -131,13 +141,15 @@ export default {
|
||||
|
||||
rowStyle(row) {
|
||||
return {
|
||||
opacity: row._remove? .8 : 1,
|
||||
backgroundColor: row._remove? '#FFC4CC': 'transparent'
|
||||
opacity: row._remove ? .8 : 1,
|
||||
backgroundColor:
|
||||
row._remove ? '#FFC4CC':
|
||||
'transparent'
|
||||
}
|
||||
},
|
||||
|
||||
isChanged (row, colId) {
|
||||
return row._changed.indexOf(colId) > -1
|
||||
return row._changed && row._changed.indexOf(colId) > -1
|
||||
},
|
||||
|
||||
revertCell(row, colId) {
|
||||
Reference in New Issue
Block a user