Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9091

Re: how to use sapui5 documentation, how to find properties of a class, how to use classes which we cant find directly like sap.ui.view , where can i find this class in documentation (https://sapui5.netweaver.ondemand.com)

$
0
0

Hi Prasad,

 

sap.ui.view is not a class but that is a standard function.

 

As everything is written in Javascript and there's a debug mode in UI5, you can see the actual source there. This is something written as a code in View-dbg.js file

In general, what this function is doing is instantiating a View based on the parameters.

 

sap.ui.view = function(sId, vView, sType /* used by factory functions */) {

  var view = null, oView = {};

 

 

  // if the id is a configuration object or a string

  // and the vView is not defined we shift the parameters

  if (typeof sId === "object" ||

  typeof sId === "string" && vView === undefined) {

  vView = sId;

  sId = undefined;

  }

 

 

  // prepare the parameters

  if (vView) {

  if (typeof vView === "string") {

  oView.viewName = vView;

  } else {

  oView = vView;

  }

  }

 

 

  // can be removed when generic type checking for special settings is introduced

  jQuery.sap.assert(!oView.async || typeof oView.async === "boolean", "sap.ui.view factory: Special setting async has to be of the type 'boolean'!");

 

 

  // apply the id if defined

  if (sId) {

  oView.id = sId;

  }

 

 

  // apply the type defined in specialized factory functions

  if (sType) {

  oView.type = sType;

  }

 

 

  // view replacement

  if (sap.ui.core.CustomizingConfiguration) {

  var customViewConfig = sap.ui.core.CustomizingConfiguration.getViewReplacement(oView.viewName, ManagedObject._sOwnerId);

  if (customViewConfig) {

  jQuery.sap.log.info("Customizing: View replacement for view '" + oView.viewName + "' found and applied: " + customViewConfig.viewName + " (type: " + customViewConfig.type + ")");

  jQuery.extend(oView, customViewConfig);

  } else {

  jQuery.sap.log.debug("Customizing: no View replacement found for view '" + oView.viewName + "'.");

  }

  }

 

 

  // view creation

  if (!oView.type) {

  throw new Error("No view type specified.");

  } else if (oView.type === sap.ui.core.mvc.ViewType.JS) {

  view = new sap.ui.core.mvc.JSView(oView);

  } else if (oView.type === sap.ui.core.mvc.ViewType.JSON) {

  view = new sap.ui.core.mvc.JSONView(oView);

  } else if (oView.type === sap.ui.core.mvc.ViewType.XML) {

  view = new sap.ui.core.mvc.XMLView(oView);

  } else if (oView.type === sap.ui.core.mvc.ViewType.HTML) {

  view = new sap.ui.core.mvc.HTMLView(oView);

  } else if (oView.type === sap.ui.core.mvc.ViewType.Template) {

  view = new sap.ui.core.mvc.TemplateView(oView);

  } else { // unknown view type

  throw new Error("Unknown view type " + oView.type + " specified.");

  }

 

 

  return view;

  };


Viewing all articles
Browse latest Browse all 9091

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>