diff --git a/src/sap/fhir/model/r4/FHIRListBinding.js b/src/sap/fhir/model/r4/FHIRListBinding.js index d5c87a8d..0c1adecc 100644 --- a/src/sap/fhir/model/r4/FHIRListBinding.js +++ b/src/sap/fhir/model/r4/FHIRListBinding.js @@ -65,7 +65,16 @@ sap.ui.define([ } this.sId = FHIRUtils.uuidv4(); this._resetData(); + }, + + initialize: function () { + // List doesn't get invalidated when context length is 0 + // as per suggestion Server-side bindings (e.g. ODataListBinding) are expected to start with a "refresh" event + // overwrite the ListBindings "initialize" + fire refresh-event (although not defined in the metadata) + this.fireEvent("refresh", { reason: ChangeReason.Refresh }); + return this; } + }); /** diff --git a/test/qunit/model/FHIRListBinding.integration.js b/test/qunit/model/FHIRListBinding.integration.js index 442b7d3c..fb4d4e3b 100644 --- a/test/qunit/model/FHIRListBinding.integration.js +++ b/test/qunit/model/FHIRListBinding.integration.js @@ -59,4 +59,16 @@ sap.ui.define(["../utils/TestUtilsIntegration", "../utils/TestUtils"], function QUnit.test("check if valueset is loaded if mentioned in the structure definition field description of type 'codeableconcept'", function (assert) { testValueSetLoadedCorrectly(assert, "/Coverage/a7854", "type", 1, 21); }); + + QUnit.test("check if refresh event is triggered during list binding initialization", function (assert) { + createContextBinding("/Patient/a2519"); + oListBinding = oModel.bindList("gender", oContextBinding.getBoundContext(), undefined, undefined, undefined); + var done = assert.async(); + var fnChangeHandler = function (oEvent) { + assert.strictEqual(oEvent.mParameters.reason, "refresh"); + done(); + }; + oListBinding.attachRefresh(fnChangeHandler); + oListBinding.initialize(); + }); }); \ No newline at end of file