From c3a47052dca2b5ee384748bbd10f7d4005a1a006 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Tue, 16 Jun 2026 09:01:44 -0600 Subject: [PATCH] Bulk edit support for clinical observations: category-dependent Observation/Score editor (#1145) ## Rationale The bulk edit dialog for the clinical observations grid offered only a plain text field for Observation/Score regardless of the selected Category, while the grid's cell editor adapts that field to the category's configured editor. This makes the bulk edit dialog offer the same category-dependent editor as the grid, so the data type and options match. ## Related Pull Requests - https://github.com/LabKey/nircEHRModules/pull/706 ## Changes - New `EHR.plugin.ClinicalObservationsBulkEdit` plugin that rebuilds the Observation/Score field from the selected category's `editorconfig`, preserving the field's enable/disable toggle state and re-registering it with the databind plugin. - `EHR.panel.BulkEditPanel` accepts panel plugins contributed via `formConfig.bulkEditPlugins`, keeping the panel itself free of observation-specific logic; the label click-to-toggle behavior is extracted into a reusable `addLabelToggle` method. - `EHR.grid.ClinicalObservationGridPanel` registers the new plugin through its `formConfig`. - The shared observation types store now tracks `hasLoadedOnce` so consumers can distinguish a pending initial load from an empty result. --- ehr/resources/web/ehr/DataEntryUtils.js | 12 +- .../web/ehr/ehr_ext4_dataEntry.lib.xml | 1 + .../ehr/grid/ClinicalObservationGridPanel.js | 10 ++ ehr/resources/web/ehr/panel/BulkEditPanel.js | 60 ++++++--- .../plugin/ClinicalObservationsBulkEdit.js | 121 ++++++++++++++++++ 5 files changed, 182 insertions(+), 22 deletions(-) create mode 100644 ehr/resources/web/ehr/plugin/ClinicalObservationsBulkEdit.js diff --git a/ehr/resources/web/ehr/DataEntryUtils.js b/ehr/resources/web/ehr/DataEntryUtils.js index e218991d3..3c3fa72cb 100644 --- a/ehr/resources/web/ehr/DataEntryUtils.js +++ b/ehr/resources/web/ehr/DataEntryUtils.js @@ -801,7 +801,17 @@ EHR.DataEntryUtils = new function(){ schemaName: 'ehr', queryName: 'observation_types', columns: 'value,editorconfig', - autoLoad: true + autoLoad: true, + listeners: { + // unlike EHR.data.DataEntryClientStore, LABKEY.ext4.data.Store has no hasLoaded(); + // consumers need to distinguish a pending initial load from one that returned no rows + load: { + single: true, + fn: function(store){ + store.hasLoadedOnce = true; + } + } + } }); return EHR._observationTypesStore; diff --git a/ehr/resources/web/ehr/ehr_ext4_dataEntry.lib.xml b/ehr/resources/web/ehr/ehr_ext4_dataEntry.lib.xml index 60557b71e..edaa925ac 100644 --- a/ehr/resources/web/ehr/ehr_ext4_dataEntry.lib.xml +++ b/ehr/resources/web/ehr/ehr_ext4_dataEntry.lib.xml @@ -21,6 +21,7 @@