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

SearchKit - Fix option loading & rendering for in-place edit #25197

Merged
merged 1 commit into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
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
SearchKit - Fix option loading & rendering for in-place edit
Fixes dev/core#4037
  • Loading branch information
colemanw committed Dec 17, 2022
commit e3711a13533a6d319ea04d32f403ec3c2921132b
5 changes: 4 additions & 1 deletion ext/search_kit/ang/crmSearchAdmin.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@
_.each(results, function(fields, entityName) {
var entity = getEntity(entityName);
_.each(fields, function(options, fieldName) {
_.find(entity.fields, {name: fieldName}).options = options;
var field = _.find(entity.fields, {name: fieldName});
if (field) {
field.options = options;
}
});
entity.optionsLoaded = true;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@

if (!_.includes(['>', '<', '>=', '<='], ctrl.op)) {
// Only use option list if the field has a "name" suffix
if (field.options && field.suffixes && field.suffixes.includes('name')) {
if (field.options && (!field.suffixes || field.suffixes.includes('name'))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what conditions would !field.suffixes be true?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the API call to getFields didn't include suffixes in the SELECT, then it would be missing. In that case I think we should assume do use the option list rather than don't, since most fields do support name.

return '~/crmSearchTasks/crmSearchInput/select.html';
}
if (field.fk_entity || field.name === 'id') {
Expand Down