cancel
Showing results for 
Search instead for 
Did you mean: 

DropDown control

Former Member
0 Kudos

HI,

I need to create custom control with aggregation of dropDownBox and label (the label should be on the left side of the drop down) which get as input (should be define as properties of the custom control ) array of values

like following array of object like following

var myValues = [

{name:"test",

name2:"test 23333"

},

{name:"test5555",

name2:"test 2fasdf"

}

...

}

my values should be sent to the custom control as parameter

when you open the screen the drop down should be enabled with selected value according to the binding but

I need that the drop down will display also the secondary value . i.e. you see name and name2 value with space inside the dropDown,

How it can be achieved in UI5 ?

Thanks,

Stephane

Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor
0 Kudos

Sorry, I do not get your questions

Can you create your custom control with your best attempt and we can fix it later?

Thanks

-D

Former Member
0 Kudos

HI Dennis,

I try the following which is doesnt work

I need it to get the following object as property entry and I need to display both value in the DDB

var myValues = [

{name:"test",

name2:"test 23333"

},

{name:"test5555",

name2:"test 2fasdf"

}

...

}

http://jsbin.com/dusuforidi/1/edit?css,js,output              

Thanks,

Stephane

former_member182862
Active Contributor
0 Kudos

sorry. I still do not get it

I have modified your jsbin

JS Bin - Collaborative JavaScript Debugging

Former Member
0 Kudos

Sorry  I sent you the wrong one,here is more appropriate one

which is related my problem

http://jsbin.com/fozizomotu/1/edit?css,js,output

former_member182862
Active Contributor
Former Member
0 Kudos

Hi Dennis,

Its not working ...

The Dropdown with the values are missing.

Thanks,

Stephane

former_member182862
Active Contributor
Former Member
0 Kudos

Thanks a lot Dennis!

How should I make it wider and provide also the secondery value for example

if this is the object I want it to display  the first and second in the same line.

var myValues = [

  {name:"first ",

   name2:"second"

  },

  {name:"aaaaa",

   name2:"bbbbbb"

  }

];

and in addtion lets say that the second object is bounded how you recomend to have the binding in this case?

Regards,

Stephane

former_member182862
Active Contributor
Former Member
0 Kudos

HI Dennis,

Thanks you very much you are awesome!

Just few little things ( my last question on this )

1. Just The binding and how you suggest to do that ? bind value that when I open the screen

I will see the binded value selected

2.How you can make it wider ?

3. Assume I need to add label in the left side of the DDB how you would do it ?

(I ask it since I want to know how its the right way to do it with renderer ...)

Best Regards,

Stephane

former_member182862
Active Contributor
0 Kudos

1. Bind when the view is created

2. make what wider?

3. http://jsbin.com/qehuquc/edit?css,js,output

thanks

-D

Former Member
0 Kudos

Hi Dennis,

1. I mean lets say that in my model i've field which is called ddbvalue and I want that the selected item will be bindeded to it how whould you do that ?

2. I mean the drop down box change the width of it to 400px for example

(I ask it since here we are dealing with renderer ...)


Thanks Again

Stephane

former_member182862
Active Contributor
Former Member
0 Kudos

HI Dennis,

This solve the issue but raise onother when I want to do like following

   var oDropDown = new DropdownBox({

   enabled: true,

  busy: false,

   change: this._onDropdownBoxChange.bind(this),

   selectedKey: '{/selected}'

   });

   self.addAggregation("_dropdownList", oDropDown);

When I do that I got error with the binding cardinality so I put the following in the

    var ddl = oControl.getAggregation('_dropdownList');

    if (ddl) {

      ddl.destroy();

      delete ddl;

    }

    ddl = new sap.m.VBox();

    oControl.setAggregation('_dropdownList', ddl);

   

    oControl.getMyData().forEach(function(x) {

      ddl.addItem(new sap.ui.core.ListItem({

        key: x.name,

        text: x.name2 + ' (' + x.name + ')'

      }));

    })

in onBeforeRendering so my question is how to use the select event .

Thanks a lot

Stephane

former_member182862
Active Contributor
0 Kudos

Hi

Can u kindly post your jsbin in a new thread?

this one is getting too long.

Thanks

-D

Answers (0)