Bug 38177: Fix lengthMenu by removing extend
$.extend is doing a deep copy of the objects.
```
var dataTablesDefaults = { "lengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, __('All')]] };
var mine = {lengthMenu: [[1, 2, 5, 10], [1, 2, 5, 10]]};
$.extend(true, {}, dataTablesDefaults, mine);
```
Returns:
```
[
1,
2,
5,
10,
-1
]
```
Which is ugly and not what we want.
We only need to merge the first level. Using the spread operator (...) will do the trick here.
Note that we certainly want to adjust all the other occurrences of
extend for DT's options.
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b1cd9cccd2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c746a74674)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
0305e36458
commit
e4c772c12f
|
|
@ -89,13 +89,14 @@ export default {
|
|||
$.fn.dataTable.ext.search = $.fn.dataTable.ext.search.filter(
|
||||
search => search.name != "apply_filter"
|
||||
)
|
||||
$("#" + table_id).dataTable(
|
||||
$.extend(true, {}, dataTablesDefaults, {
|
||||
$("#" + table_id).dataTable({
|
||||
...dataTablesDefaults,
|
||||
...{
|
||||
data: resources,
|
||||
embed: ["package.name"],
|
||||
ordering: false,
|
||||
dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>',
|
||||
aLengthMenu: [
|
||||
lengthMenu: [
|
||||
[10, 20, 50, 100],
|
||||
[10, 20, 50, 100],
|
||||
],
|
||||
|
|
@ -177,8 +178,8 @@ export default {
|
|||
)
|
||||
})
|
||||
},
|
||||
})
|
||||
)
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue