Skip to content

Commit

Permalink
fix: remove columns property from DEFAULT_OPTIONS if provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxycle committed Apr 16, 2022
1 parent 93d3035 commit 5485b64
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/filterable-table/FilterableTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import { createNamespacedHelpers } from 'vuex'
import { DEFAULT_OPTIONS, DUMMY_DATA } from './constants.js'
import { setAxiosHeaders } from '../../helpers/helpers-axios.js'
import { merge } from 'lodash'
import TableHead from './TableHead.vue'
import TableFilters from './TableFilters.vue'
import TableModal from './TableModal.vue'
Expand Down Expand Up @@ -242,14 +242,16 @@ export default {
importUserOptions () {
const providedOptions = typeof(this.options) == 'object' ? this.options : {}
const defaultOptionsWithoutColumns = JSON.parse(JSON.stringify(DEFAULT_OPTIONS));
delete defaultOptionsWithoutColumns.columns // remove default columns widths which was messing the vertical alignment
const defaultOptionsToMerge = Object.prototype.hasOwnProperty.call(providedOptions, 'columns') ? defaultOptionsWithoutColumns : DEFAULT_OPTIONS
const options = { ...merge(providedOptions, defaultOptionsToMerge) }
const obj = {
tableId: this.id,
options: {
...DEFAULT_OPTIONS,
...providedOptions
}
options
}
this.updateOptions(obj)
},
Expand Down

0 comments on commit 5485b64

Please sign in to comment.