简体   繁体   English

扩展sap.m.List会给我错误:…无法加载“ sap / m / items.js”

[英]Extending sap.m.List gives me error: …failed to load 'sap/m/items.js'

I tried to extend sap.m.List to a new custom control which i will call MyList here. 我试图扩大sap.m.List到一个新的自定义控制,我会打电话给MyList这里。

Right now my MyList does nothing fancy. 现在,我的MyList没有任何幻想。 Its definition looks like this: 其定义如下所示:

sap.ui.define([
  "sap/m/ListBase"
], function (List) {
  "use strict";
  return List.extend("companyname.control.MyList", {
    metadata : {
      defaultAggregation : "items",
      aggregations: {
        items: {type: "sap.ui.core.Control", multiple: true}
      },
    },
    renderer: {}
  });
});

But when i use it with a simple UI5 Control in <items>...</items> , i get this JavaScript error: 但是,当我将它与<items>...</items>的简单UI5控件一起使用时,出现此JavaScript错误:

...failed to load 'sap/m/items.js'...

This happens when i use a simple Control but not with a ListItem. 当我使用简单的控件但不使用ListItem时会发生这种情况。 Even tough i told MyList to accept type: "sap.ui.core.Control" as items . 即使强硬。我告诉MyList接受type: "sap.ui.core.Control"items

I think its a lack of understanding how to extend lists. 我认为缺乏对如何扩展列表的理解。 But i cant find any examples for extending sap.m.List on the web. 但是我找不到在网络上扩展sap.m.List任何示例。

What's the namespace you're maintaining in the view for your control ? 您在控件的视图中维护的名称空间是什么? Say if it's 说是

xmlns:company = companyname.control xmlns:company = companyname.control

then you'll have to use this namespace with your control's aggregation. 那么您将不得不在控件的聚合中使用此命名空间。

<company:items></company:items>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM