|
Lines 31-36
export default {
Link Here
|
| 31 |
included_ids, |
31 |
included_ids, |
| 32 |
table_settings: this.table_settings, |
32 |
table_settings: this.table_settings, |
| 33 |
}) |
33 |
}) |
|
|
34 |
|
| 35 |
if (this.add_filters) { |
| 36 |
this.options.orderCellsTop = true |
| 37 |
} |
| 38 |
|
| 39 |
if (this.table_settings) { |
| 40 |
let columns_settings = this.table_settings["columns"] |
| 41 |
let table_key = "DataTables_%s_%s_%s".format( |
| 42 |
this.table_settings.module, |
| 43 |
this.table_settings.page, |
| 44 |
this.table_settings.table |
| 45 |
) |
| 46 |
|
| 47 |
let default_save_state = this.table_settings.default_save_state |
| 48 |
let default_save_state_search = |
| 49 |
this.table_settings.default_save_state_search |
| 50 |
|
| 51 |
if (default_save_state) { |
| 52 |
this.options.stateSave = true |
| 53 |
this.options.stateSaveCallback = function (settings, data) { |
| 54 |
if (!default_save_state_search) { |
| 55 |
delete data.search |
| 56 |
data.columns.forEach(c => delete c.search) |
| 57 |
} |
| 58 |
localStorage.setItem(table_key, JSON.stringify(data)) |
| 59 |
} |
| 60 |
this.options.stateLoadCallback = function (settings) { |
| 61 |
return JSON.parse(localStorage.getItem(table_key)) |
| 62 |
} |
| 63 |
let local_settings = localStorage.getItem(table_key) |
| 64 |
columns_settings = _dt_get_saved_state( |
| 65 |
local_settings, |
| 66 |
columns_settings |
| 67 |
) |
| 68 |
} else { |
| 69 |
localStorage.removeItem(table_key) |
| 70 |
} |
| 71 |
|
| 72 |
if ( |
| 73 |
this.table_settings.hasOwnProperty("default_display_length") && |
| 74 |
this.table_settings.default_display_length != null |
| 75 |
) { |
| 76 |
this.options.pageLength = |
| 77 |
this.table_settings.default_display_length |
| 78 |
} |
| 79 |
if ( |
| 80 |
this.table_settings.hasOwnProperty("default_sort_order") && |
| 81 |
this.table_settings.default_sort_order != null |
| 82 |
) { |
| 83 |
this.options.order = [ |
| 84 |
[this.table_settings.default_sort_order, "asc"], |
| 85 |
] |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 34 |
return { |
89 |
return { |
| 35 |
data: [], |
90 |
data: [], |
| 36 |
tableColumns: this.columns, |
91 |
tableColumns: this.columns, |
|
Lines 186-213
export default {
Link Here
|
| 186 |
}, |
241 |
}, |
| 187 |
] |
242 |
] |
| 188 |
} |
243 |
} |
| 189 |
|
|
|
| 190 |
if (this.add_filters) { |
| 191 |
this.options.orderCellsTop = true |
| 192 |
} |
| 193 |
|
| 194 |
if (this.table_settings) { |
| 195 |
if ( |
| 196 |
this.table_settings.hasOwnProperty("default_display_length") && |
| 197 |
this.table_settings.default_display_length != null |
| 198 |
) { |
| 199 |
this.options.pageLength = |
| 200 |
this.table_settings.default_display_length |
| 201 |
} |
| 202 |
if ( |
| 203 |
this.table_settings.hasOwnProperty("default_sort_order") && |
| 204 |
this.table_settings.default_sort_order != null |
| 205 |
) { |
| 206 |
this.options.order = [ |
| 207 |
[this.table_settings.default_sort_order, "asc"], |
| 208 |
] |
| 209 |
} |
| 210 |
} |
| 211 |
}, |
244 |
}, |
| 212 |
mounted() { |
245 |
mounted() { |
| 213 |
let dt = this.$refs.table.dt() |
246 |
let dt = this.$refs.table.dt() |
| 214 |
- |
|
|