Bug 29397: Add .kohaSelect select2 wrapper function
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 3 Nov 2021 14:37:11 +0000 (14:37 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Sat, 22 Jan 2022 07:34:51 +0000 (21:34 -1000)
commitc5a4c193f44a7829d766a49c1b8b0a842aca4bf4
treed694d0ac6cd61d9aa1bafee7d2539d05378116b7
parentf9bb92fb80789a77dca0bbce8d6c3b21e5cad6c8
Bug 29397: Add .kohaSelect select2 wrapper function

This patch adds a kohaSelect wrapper function to simplify
paging/infinite scrolling with select2 using the Koha RESTful api's.

Invoke select2 select boxes as you normally would from JS, but instead
of calling .select2(config) use .kohaSelect(config).

If an 'ajax' property is defined in your config object, we wrap the
transport such that responses include a pagination key as expected by
select2.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
koha-tmpl/intranet-tmpl/prog/js/select2.js