Skip to content

Commit

Permalink
Add option to disable backend searching for PickListSelect2Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
bffrost committed Mar 10, 2025
1 parent 97c6c92 commit b2d18df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions modules/CmpdRegBulkLoader/src/client/CmpdRegBulkLoader.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,13 @@ class AssignedPropertyController extends AbstractFormController
code: ""
name: "Select"
selectedCode: ""
backendSearch: false

setupInput: =>
# Alter input depending on dbProperty
dbProp = @model.get('dbProperty')
if @dbPropertyUrls[dbProp]? || dbProp.includes("Units")
@dbPropertyUrl = @dbPropertyUrls[@model.get('dbProperty')]
@dbPropertyUrl = @dbPropertyUrls[dbProp]
if !@dbPropertyUrl?
@dbPropertyUrl = @dbPropertyUrls["Units"]
@setupSelect()
Expand All @@ -358,7 +359,7 @@ class AssignedPropertyController extends AbstractFormController
@selectListController = null
@$('.bv_defaultVal').show()
# Show date picker if dbProperty is a date
if @model.get('dbProperty').includes("Lot Synthesis Date")
if dbProp.includes("Lot Synthesis Date")
@$('.bv_defaultVal').datepicker();
@$('.bv_defaultVal').datepicker( "option", "dateFormat", "yy-mm-dd" );
@$('.bv_defaultVal').attr('placeholder', 'YYYY-MM-DD')
Expand Down
6 changes: 4 additions & 2 deletions modules/Components/src/client/PickList.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,10 @@ class PickListSelect2Controller extends PickListSelectController
allowClear: true
width: @width

# Conditionally add the ajax property
if @collection.url?
# Conditionally add the ajax property to enable backend searching
# If a url is provided, backend search is enabled by default but
# can be toggled off by setting the 'backendSearch' option to false
if @collection.url? && (!@options.backendSearch? || @options.backendSearch is true)
select2Options.ajax =
url: (params) =>
if !params.term?
Expand Down

0 comments on commit b2d18df

Please sign in to comment.