Skip to content

Commit

Permalink
Merge pull request #1156 from mcneilco/ACAS-769
Browse files Browse the repository at this point in the history
ACAS-769: Fix Bulkloader picklists by only using new type ahead when a url is provided to selection
  • Loading branch information
brianbolt authored Apr 25, 2024
2 parents 4dcd0ad + 0526904 commit 9485335
Showing 1 changed file with 9 additions and 2 deletions.
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

0 comments on commit 9485335

Please sign in to comment.