]> git.koha-community.org Git - koha.git/commit
Bug 38177: Fix lengthMenu by removing extend
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 22 Oct 2024 08:52:46 +0000 (10:52 +0200)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Wed, 23 Oct 2024 17:14:53 +0000 (19:14 +0200)
commitb1cd9cccd2918f954b6e675bf1b7bad853548372
treef2e6785f9cd3ff1917594119c6321df97a658e04
parentca0e745c1d573522a19cf62fc38b2241b671c1dd
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>
koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlePackagesList.vue