Skip to Content
1
Sep 26, 2019 at 08:30 AM

library preload in controller using sap.ui.define

554 Views Last edit Sep 26, 2019 at 09:20 AM 3 rev

Hello,

We are using viz controls to build charts, and I observed that we are using 32 controls from the same library.

But I can't do library preload at index html or bootstrap level, because the framework that we are using is re-used across multiple application and many of those are not using viz library.

So, I tried loading the library-preload.js in the controller where the chart are used. Below is the code snippet of the same.

Please suggest is it fine to use this way.

sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/m/IconTabFilter", "sap/ui/model/json/JSONModel", "sap/viz/library-preload" ], function(Controller,
IconTabFilter, JSONModel, vizLib) {


});

This is avoiding 30+ requests as all required controls are loaded in a single file.