Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACAS-769: Fix Bulkloader picklists by only using new type ahead when a url is provided to selection #1156

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions modules/Components/src/client/PickList.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,17 @@ class PickListSelect2Controller extends PickListSelectController
if @options?.placeholder?
@placeholder = @options.placeholder

$(@el).select2
# Define the base options
select2Options =
placeholder: @placeholder
data: mappedData
openOnEnter: false
allowClear: true
width: @width
ajax:

# Conditionally add the ajax property
if @collection.url?
select2Options.ajax =
url: (params) =>
if !params.term?
params.term = ''
Expand All @@ -382,6 +386,9 @@ class PickListSelect2Controller extends PickListSelectController
results = for option in data
{id: option.code, text: option.name}
return {results: results}

# Initialize select2 with the options
$(@el).select2(select2Options)

@setSelectedCode @selectedCode
@rendered = true
Expand Down
Loading