openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

sap.uxap.ObjectPageLayout: enableLazyLoading not working

Open born2dev opened this issue 7 years ago • 4 comments

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

born2dev avatar Dec 07 '18 13:12 born2dev

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.

boghyon avatar Dec 07 '18 14:12 boghyon

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

born2dev avatar Dec 11 '18 07:12 born2dev

I was thinking that too. Created https://github.com/SAP/openui5/issues/2321

boghyon avatar Dec 11 '18 08:12 boghyon

@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

boghyon avatar Jan 11 '19 11:01 boghyon