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)
committerKyle Hall <kyle@bywatersolutions.com>
Mon, 7 Feb 2022 12:00:09 +0000 (07:00 -0500)
commitbabd32dc5cd17bedb33dbeb683761ba46b361883
treea9e18127587a77fab16fcdb295974cdcbc006772
parent1eed3d49edfd324edbd79fbb33cbbe1dc4fdf5ce
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