cancel
Showing results for 
Search instead for 
Did you mean: 

Create new control issue

Former Member
0 Kudos

Hi All,

I try to create new UI5 control which is composite control and I need to use the DropdownBox as aggregation

This is my code.

sap.ui.define([
"sap/ui/core/Control",

"sap/ui/core/DropdownBox",


], function (Control, DropdownBox) {

Control.extend("newControl", {

  metadata: {

  aggregations: {

  dropdownBox: {

  type: "sap.ui.commons.DropdownBox",

  mutiple: true,

  visibility: "hidden"

  },

....

Now I want to use the following

this.setAggregation("dropdownBox", new DropdownBox({

  enabled: false,

  busy: true,

  layoutData: new sap.ui.layout.GridData({

  span: "L7 M8 S12"

  })

  }));

In this line of the setAggregation I got error when I run my app

Uncaught Error: Aggregation '_dropdownBox' of Element newControl#__section2 used with wrong cardinality (declared as 0..n)

What am I missing here ?

I've tried also with multiple false and I got the same error   please assist .

Miley

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor

not setAggregation but addAggregation it is mutiple: true

Former Member
0 Kudos

Hey Maksim

Not sure I fully understand what I should change here,can you please tell me what I shold change ?

Thank you

former_member182372
Active Contributor
0 Kudos

this.addAggregation ("dropdownBox", new DropdownBox({

  enabled: false,

  busy: true,

  layoutData: new sap.ui.layout.GridData({

  span: "L7 M8 S12"

  })

  }));

Former Member
0 Kudos

Thank you Maksim

I've changed it but now Im getting diffrent error on

oRm.renderControl(oControl.getAggregation("dropdownBox"));

C.getId is not a function

Do I use it incorrect ?

Miley

former_member182372
Active Contributor

oRm.renderControl(oControl.getAggregation("dropdownBox")[0]);

Answers (0)