cancel
Showing results for 
Search instead for 
Did you mean: 

getting error in IconTabHeader.js file as Uncaught TypeError: b[i]._getNonEmptyKey is not a function

Former Member
0 Kudos

Hi all,

I am getting Uncaught TypeError: b[i]._getNonEmptyKey is not a function error in IconTabHeader.js. What does it mean exactly?

any file to be included?

Accepted Solutions (0)

Answers (1)

Answers (1)

saivellanki
Active Contributor
0 Kudos

Hi Monika,

I guess there is some problem with selected key property that has been set to IconTabBar. Can you share the code?

Regards,

Sai Vellanki.

Former Member
0 Kudos

Hi sai,

This is the code:

<mvc:View height="100%" controllerName="AssetPro.assetpro.ObjectHeader"

  xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout"

  xmlns:u="sap.ui.unified" xmlns:html="http://www.w3.org/1999/xhtml"

  xmlns="sap.m">

  <html:style>

  .sapMPanelHdr:not(.sapMPanelHdrExpandable), .sapMPanelWrappingDiv, .sapMPanelWrappingDivTb {

  border-bottom: 0px solid #cdcdcd;

  border-top: 1px solid #cdcdcd;

  }

  .sapMTB-Transparent-CTX .sapMLabel {

  font-weight: normal;

  font-size: 14px;

  font-family: Arial,Helvetica,sans-serif;

  text-shadow: 0 1px 0 #ffffff;

  color: #333333;

  }

  .sapHeadFlexItem {

  position: relative;

  height: 40px;}

  .sapUiSmallMargin {

    margin: 0.75rem!important;

}

  .sapMInputBaseInner {

  height: 1.5rem;

  }

  .sapMSplitContainerHideMode>.sapMSplitContainerDetail

  .sapMITB.sapUiResponsiveContentPadding>.sapMITBContainerContent>.sapMITBContent,

  .sapMITB.sapUiResponsiveContentPadding>.sapMITBContainerContent>.sapMITBContent

  {

  box-sizing: border-box;

  padding:0rem;

  }

  .sapMInputValHelpInner {

  height: 1.5rem;

  line-height: 1.5rem;

  }

  .sapMDP>.sapUiIcon, .sapMDP.sapMInputIE9>.sapUiIcon {

  height: 1.5rem;

  line-height: 1.5rem;

  }

  .sapMLabel {

  color: black;

  }

  .labelFont {font-size: 14px;}

  .sapMTB-Transparent-CTX .sapMText {

  font-size: 12px;

  color:Grey;}

  .sapMScrollCont {

  overflow: hidden;

  position: relative;

  padding-left:2rem;

  padding-right:2rem;

  }

  .sapMScrollContV .sapMScrollContScroll {

  display: block;

  background-color: white;}

  .sapTopPanelPadding {

  padding-top: 50px;

  padding-bottom:5px;}

  .tabHeader {font-size: 20px; padding-top:1rem; padding-left:2rem;}

  </html:style>

  <ObjectHeader id="oh1" responsive="true"

  backgroundDesign="Translucent">

  <headerContainer>

  <IconTabBar id="itb1" selectedKey="key3" upperCase="true"

  backgroundDesign="Transparent" applyContentPadding="false"

  class="sapUiResponsiveContentPadding">

  <Page title="Title">

  <content>

  <items>

  <core:Fragment fragmentName="AssetPro.assetpro.DetailSlide"

  type="XML" />

  <!-- <IconTabFilter text="Attachments">

  <Text text="Attachments go here ..." />

  </IconTabFilter>

  <IconTabFilter text="Notes">

  <Text text="Notes go here ..." />

  </IconTabFilter> -->

  </items>

  </content>

  </Page>

  </IconTabBar>

  </headerContainer>

  </ObjectHeader>

</mvc:View>

saivellanki
Active Contributor
0 Kudos

Monika,

Few things -

1. Is there any specific reason to have CSS in XML view?

2. Any reason to use Page control inside ObjectListItem? Instead, I would say directly use items aggregation of Icon Tab Bar.

3. In IconTabBar selected key argument, you have to provide the icontabfilter ID that needs to be selected. I would recommend to declare ID's to your IconTabFilters. In your case the code will be like this -


<IconTabBar id="itb1" selectedKey="__filter1" upperCase="true"

backgroundDesign="Transparent" applyContentPadding="false"

class="sapUiResponsiveContentPadding">

"__filter1" is automatically generated id for "Notes" since there is no id declared. You can find the run time id's using inspect element of chrome.

I tweaked your code, check the working sample here:JS Bin - Collaborative JavaScript Debugging

Regards,

Sai Vellanki.

Former Member
0 Kudos

hello Sai,

Thank you for the rply,i will try it out.

Can u help me why i am getting the error in component.js as "Uncaught Error: The specified component controller 'AssetPro.Component' could not be found!"

saivellanki
Active Contributor
0 Kudos

Monika,

Check the namespace whether it is correct / not. Can you share the code of index.html and Component.js?

In the mean time, you can check the code syntax here: SAPUI5 Explored

Regards,

Sai Vellanki.

Former Member
0 Kudos

hi sai,

index.html:

<!DOCTYPE HTML>

<html>

  <head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

  <script src="resources/sap-ui-core.js"

  id="sap-ui-bootstrap"

  data-sap-ui-libs="sap.m,sap.ui.comp,sap.ui.layout,sap.ui.unified"

  data-sap-ui-resourceroots='{"AssetPro": "./"}'

  data-sap-ui-theme="sap_bluecrystal">

  </script>

  <!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

  <script>

  /* sap.ui.localResources("spinner");

  var app = new sap.m.App({initialPage:"idView11"});

  var page = sap.ui.view({id:"idView11", viewName:"spinner.ObjectHeader", type:sap.ui.core.mvc.ViewType.XML});

  app.addPage(page);

  app.placeAt("content"); */

  sap.ui.getCore().attachInit(function() {

  new sap.m.App ({

     pages: [

         new sap.m.Page({

             title: "Asset Acquisition - Post Capitalization",

             enableScrolling : true,

         content: [ new sap.ui.core.ComponentContainer({

         name : "AssetPro"

         })]

      })

      ]

  }).placeAt("content");

  });

  </script>

  </head>

  <body class="sapUiBody" role="application">

  <div id="content"></div>

  </body>

</html>

<!-- <!DOCTYPE HTML>

<html>

  <head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

  <script src="https://sapui5.netweaver.ondemand.com/resources/sap-ui-core.js"

  id="sap-ui-bootstrap"

  data-sap-ui-libs="sap.m,sap.ui.comp,sap.ui.layout"

  data-sap-ui-theme="sap_bluecrystal">

  </script>

  only load the mobile lib "sap.m" and the "sap_bluecrystal" theme

       <script src="resources/underscore.js">

       </script>

  <script>

  sap.ui.localResources("assetpro");

  var app = new sap.m.App({initialPage:"idTrial1"});

  var page = sap.ui.view({id:"idTrial1", viewName:"assetpro.Trial", type:sap.ui.core.mvc.ViewType.XML});

  app.addPage(page);

  app.placeAt("content");

  </script>

  </head>

  <body class="sapUiBody" role="application">

  <div id="content"></div>

  </body>

</html> -->

Component.js:

/*!

* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)

* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.

* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.

*/

/**

* @fileOverview Application component to test bindings using OData types.

* @version @version@

*/

jQuery.sap.declare("AssetPro.Component");

jQuery.sap.require("sap.ui.model.odata.AnnotationHelper");

sap.ui.core.UIComponent.extend("AssetPro.assetpro.Component", {

  createContent: function () {

   

  // var oModel = new sap.ui.model.json.JSONModel();

  

  var oModel = new sap.ui.model.json.JSONModel({

  "ProductCollection": [

  {

  "ProductId": "1239102",

  "Name": "Power Projector 4713",

  "Category": "Projector",

  "SupplierName": "Titanium",

  "Description": "A very powerful projector with special features for Internet usability, USB",

  "WeightMeasure": 1467,

  "WeightUnit": "g",

  "Price": 856.49,

  "CurrencyCode": "EUR",

  "Status": "Available",

  "Quantity": 3,

  "UoM": "PC",

  "Width": 51,

  "Depth": 42,

  "Height": 18,

  "DimUnit": "cm",

  "ProductPicUrl": "https://sapui5.hana.ondemand.com/sdk/test-resources/sap/ui/demokit/explored/img/HT-6100.jpg"

  },

  {

  "ProductId": "2212-121-828",

  "Name": "Gladiator MX",

  "Category": "Graphics Card",

  "SupplierName": "Technocom",

  "Description": "Gladiator MX: DDR2 RoHS 128MB Supporting 512MB Clock rate: 350 MHz Memory Clock: 533 MHz, Bus Type: PCI-Express, Memory Type: DDR2 Memory Bus: 32-bit Highlighted Features: DVI Out, TV Out , HDTV",

  "WeightMeasure": 321,

  "WeightUnit": "g",

  "Price": 81.7,

  "CurrencyCode": "EUR",

  "Status": "Discontinued",

  "Quantity": 10,

  "UoM": "PC",

  "Width": 34,

  "Depth": 14,

  "Height": 2,

  "DimUnit": "cm",

  "ProductPicUrl": "https://sapui5.hana.ondemand.com/sdk/test-resources/sap/ui/demokit/explored/img/HT-1071.jpg"

  },

  {

  "ProductId": "K47322.1",

  "Name": "Hurricane GX",

  "Category": "Graphics Card",

  "SupplierName": "Red Point Stores",

  "Description": "Hurricane GX: DDR2 RoHS 512MB Supporting 1024MB Clock rate: 550 MHz Memory Clock: 933 MHz, Bus Type: PCI-Express, Memory Type: DDR2 Memory Bus: 64-bit Highlighted Features: DVI Out, TV-In, TV-Out, HDTV",

  "WeightMeasure": 588,

  "WeightUnit": "g",

  "Price": 219,

  "CurrencyCode": "EUR",

  "Status": "Out of Stock",

  "Quantity": 25,

  "UoM": "PC",

  "Width": 34,

  "Depth": 14,

  "Height": 2,

  "DimUnit": "cm",

  "ProductPicUrl": "https://sapui5.hana.ondemand.com/sdk/test-resources/sap/ui/demokit/explored/img/HT-1072.jpg"

  },

  {

  "ProductId": "22134T",

  "Name": "Webcam",

  "Category": "Accessory",

  "SupplierName": "Technocom",

  "Description": "Web camera, color, High-Speed USB",

  "WeightMeasure": 700,

  "WeightUnit": "g",

  "Price": 59,

  "CurrencyCode": "EUR",

  "Status": "Available",

  "Quantity": 22,

  "UoM": "PC",

  "Width": 18,

  "Depth": 19,

  "Height": 21,

  "DimUnit": "cm",

  "ProductPicUrl": "https://sapui5.hana.ondemand.com/sdk/test-resources/sap/ui/demokit/explored/img/HT-1112.jpg"

  },

  {

  "ProductId": "P1239823",

  "Name": "Monitor Locking Cable",

  "Category": "Accessory",

  "SupplierName": "Technocom",

  "Description": "Lock for Monitor",

  "WeightMeasure": 40,

  "WeightUnit": "g",

  "Price": 13.49,

  "CurrencyCode": "EUR",

  "Status": "Available",

  "Quantity": 30,

  "UoM": "PC",

  "Width": 11,

  "Depth": 11,

  "Height": 3,

  "DimUnit": "cm",

  "ProductPicUrl": "test-resources/sap/ui/demokit/explored/img/HT-1111.jpg"

  },

  {

  "ProductId": "214-121-828",

  "Name": "Laptop Case",

  "Category": "Accessory",

  "SupplierName": "Red Point Stores",

  "Description": "Laptop Case with room for pencils and other items",

  "WeightMeasure": 1289,

  "WeightUnit": "g",

  "Price": 78.99,

  "CurrencyCode": "EUR",

  "Status": "Discontinued",

  "Quantity": 15,

  "UoM": "PC",

  "Width": 53,

  "Depth": 34,

  "Height": 7,

  "DimUnit": "cm",

  "ProductPicUrl": "test-resources/sap/ui/demokit/explored/img/HT-1114.jpg"

  }]

   });

        // oModel.loadData("spinner/Model/products.json");

  

   var oViewContainer = new sap.m.VBox();

console.log(oModel);

sap.ui.getCore().setModel(oModel);

var oViewTemplate = sap.ui.view({

                    preprocessors: {

                        xml: {

                            models: {

                                tmpl: oModel // we are assigning model to template with the name "tmpl"

                            }

                        }

                    },

                    type: sap.ui.core.mvc.ViewType.XML,

                    viewName: "AssetPro.assetpro.ObjectHeader" // path to xml template  file.

                });

oViewContainer.addItem(oViewTemplate);

return oViewContainer;

}

});