fix col order reset button, show only if order is changed

pull/35/head
Ondřej Hruška 6 years ago
parent 58c28b776b
commit 70cff26719
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 2
      app/Http/Controllers/TableEditController.php
  2. 9
      resources/assets/js/components/ColumnEditor.vue

@ -262,6 +262,7 @@ class TableEditController extends Controller
case 'col.sort':
$changeset->setColOrder($input->order);
$resp = !empty($changeset->columnOrder); // return flag if order is changed
break;
case 'note.set':
@ -270,6 +271,7 @@ class TableEditController extends Controller
case 'reset.col-order': // called via POST or GET
$changeset->resetColumnOrder();
$resp = $changeset->fetchAndTransformColumns(); // return all columns
break;
case 'reset.col-remove': // called via GET

@ -20,7 +20,7 @@ Complex animated column editor for the table edit page
<th :style="tdWidthStyle('type')">Type</th>
<th :style="tdWidthStyle('title')">Title</th>
<th>
<a href="" type="button" v-if="!newTable"
<a href="" type="button" v-if="!newTable && orderChanged"
@click.prevent="resetOrder()"
class="text-danger no-decoration">
Reset Order
@ -205,10 +205,12 @@ export default {
newTable: { type: Boolean, default: false },
name: { type: String, required: true },
xColumns: { type: Array, required: true },
orderChanged: { type: Boolean, default: false },
},
data () {
return {
newColNum: 0,
orderChanged: this.orderChanged,
columns: this.xColumns,
colTypes: ['string', 'int', 'float', 'bool'],
debouncedSortUpdate: _.debounce(() => this.submitColOrder(), 350)
@ -225,6 +227,8 @@ export default {
this.query ({
action: 'col.sort',
order: ids,
}, (resp) => {
this.orderChanged = resp.data;
})
},
@ -417,7 +421,8 @@ export default {
this.query({
action: 'reset.col-order'
}, (resp) => {
this.columns = resp.data;
this.columns = resp.data
this.orderChanged = false
})
}
}

Loading…
Cancel
Save