简体   繁体   中英

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.

Right now my MyList does nothing fancy. 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:

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

This happens when i use a simple Control but not with a ListItem. Even tough i told MyList to accept type: "sap.ui.core.Control" as 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.

What's the namespace you're maintaining in the view for your control ? Say if it's

xmlns:company = companyname.control

then you'll have to use this namespace with your control's aggregation.

<company:items></company:items>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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