sap.uxap.ObjectPageLayout: enableLazyLoading not working
I use the sap.uxap.ObjectPageLayout with useIconTabBar="true". The content of the tab with title="B" should only be loadad if the tab is clicked. However on Chromes Network page I can see that the view "my.View" is instantly loaded.
My example:
<ObjectPageLayout id="ObjectPageLayout"
headerContentPinnable="true" enableLazyLoading="true"
useIconTabBar="true">
<sections>
<ObjectPageSection
title="A">
<subSections>
<ObjectPageSubSection
title="A1">
<blocks>
<f:SimpleForm>
…
</f:SimpleForm>
</blocks>
</ObjectPageSubSection>
<ObjectPageSubSection
title="A2">
<blocks>
<f:SimpleForm>
...
</f:SimpleForm>
</blocks>
</ObjectPageSubSection>
</subSections>
</ObjectPageSection>
<ObjectPageSection
title="B">
<subSections>
<ObjectPageSubSection>
<blocks>
<mvc:XMLView viewName="my.View"></mvc:XMLView>
</blocks>
</ObjectPageSubSection>
</subSections>
</ObjectPageSection>
</sections>
This example works:
https://openui5.hana.ondemand.com/1.58.4/#/sample/sap.uxap.sample.ObjectPageOnJSONWithLazyLoading/code/ObjectPageOnJSONWithLazyLoading.view.xml
Contrary to my example it is not with useIconTabBar="true" but I guess this has no influence on the lazy loading.
OpenUI5 version: 1.58.4
The documentation Object Page Layout mentions how to enable lazy loading:
Lazy Loading
If you want to use lazy loading, all your blocks must be based on
BlockBase, otherwise they are loaded as normal OpenUI5 components.
You can go through these guides accordingly:
Alternatively, UI5 also supports enabling lazy loading without having to create custom Blocks. Take a look at this sample with ObjectPageLazyLoader.
Thank you, I got it working!
By the way I wouldn't have opened this issue if the file
https://openui5.hana.ondemand.com/test-resources/sap/uxap/demokit/sample/SharedBlocks/employment/EmploymentBlockJob.js
was listed after you press "Show source code for this example" on https://openui5.hana.ondemand.com/#/sample/sap.uxap.sample.ObjectPageOnJSONWithLazyLoading/preview
I was thinking that too. Created https://github.com/SAP/openui5/issues/2321
@born2dev
By the way I wouldn't have opened this issue if the file EmploymentBlockJob.js was listed after you press "Show source code for this example" on https://openui5.hana.ondemand.com/#/sample/sap.uxap.sample.ObjectPageOnJSONWithLazyLoading/preview
Now listed in the upcoming versions: https://openui5nightly.hana.ondemand.com/#/sample/sap.uxap.sample.ObjectPageOnJSONWithLazyLoading/code/..%2FSharedBlocks%2Femployment%2FEmploymentBlockJob.js