Skip to content

Commit

Permalink
Force find all resources that the backend returns
Browse files Browse the repository at this point in the history
You can't disable the client side searching even when we do all search in the backend (selectize.js is stupid: selectize/selectize.js#1494), this will match all returned records, everytime.
  • Loading branch information
himynameisjonas committed Oct 13, 2021
1 parent fc8eed4 commit beed5f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/assets/javascripts/belongs_to_search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $(function() {
$element.selectize({
valueField: 'id',
labelField: 'dashboard_display_name',
searchField: 'dashboard_display_name',
searchField: ['dashboard_display_name', 'searchField'],
create: false,
searchUrl: $element.data('url') + '?search=',

Expand All @@ -19,7 +19,10 @@ $(function() {
callback();
},
success: function(res) {
callback(res.resources);
callback(res.resources.map(function(resource){
resource.searchField = query
return resource
}));
}
});
},
Expand Down

0 comments on commit beed5f3

Please sign in to comment.