Guest User

Untitled

a guest
May 3rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sap.ui.define([
  2.     "sap/ui/core/UIComponent",
  3.     "sap/ui/Device",
  4.     "mdm/cmd/product/maintain/ext/ArticleHierarchy/model/models",
  5.     "sap/suite/ui/generic/template/extensionAPI/ReuseComponentSupport",
  6.     "sap/suite/ui/generic/template/extensionAPI/extensionAPI",
  7.     "mdm/cmd/product/maintain/ext/ArticleHierarchy/util/ModelHelper"
  8. ], function(UIComponent, Device, models, ReuseComponentSupport, extensionAPI, ModelHelper) {
  9.     "use strict";
  10.  
  11.     return UIComponent.extend("mdm.cmd.product.maintain.ext.ArticleHierarchy.Component", {
  12.  
  13.         metadata: {
  14.             manifest: "json",
  15.             properties: {
  16.                 draftKey: {
  17.                     type: "string",
  18.                     bindable: true,
  19.                     defaultValue: null
  20.                 },
  21.                 product: {
  22.                     type: "string",
  23.                     bindable: true,
  24.                     defaultValue: null
  25.                 },
  26.                 uiMode: {
  27.                     type: "string",
  28.                     group: "standard",
  29.                     defaultValue: "Display"
  30.                 }
  31.             }
  32.         },
  33.  
  34.         /**
  35.          * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
  36.          * @public
  37.          * @override
  38.          */
  39.         init: function() {
  40.             // call the base component's init function
  41.             UIComponent.prototype.init.apply(this, arguments);
  42.  
  43.             // set the device model
  44.             this.setModel(models.createDeviceModel(), "device");
  45.             ReuseComponentSupport.mixInto(this);
  46.         },
  47.         createContent: function() {
  48.             debugger;
  49.             this.oView = sap.ui.view({
  50.                 viewName: "mdm.cmd.product.maintain.ext.ArticleHierarchy.view.ArticleHierarchy",
  51.                 type: sap.ui.core.mvc.ViewType.XML
  52.             });
  53.  
  54.             // Transforms this component into a reuse component for smart templates.
  55.             ReuseComponentSupport.mixInto(this, "component");
  56.  
  57.             return this.oView;
  58.         },
  59.         stStart: function(oModel, oBindingContext, oExtensionAPI) {
  60.             debugger;
  61.             var that = this;
  62.             this._oModel = oModel;
  63.             this._oBindingContext = oBindingContext;
  64.             var oController = this.oView.getController();
  65.             oController._extensionAPI = oExtensionAPI;
  66.             var fnSuccess1 = function(oSuccess) {
  67.                 that.fnSuccess(oSuccess, oModel);
  68.             };
  69.             ModelHelper.readAHHeader(oModel, oBindingContext, fnSuccess1);
  70.         },
  71.         stRefresh: function(oModel, oBindingContext) {
  72.             this.oView.byId("ArticleHierarchy").destroyItems();
  73.             var that = this;
  74.             var fnSuccess1 = function(oSuccess) {
  75.                 that.fnSuccess(oSuccess, oModel);
  76.             };
  77.             ModelHelper.readAHHeader(oModel, oBindingContext, fnSuccess1);
  78.         }
  79.     });
  80. });
Add Comment
Please, Sign In to add comment