cancel
Showing results for 
Search instead for 
Did you mean: 

Add new control via extend

Former Member
0 Kudos

Hi,

Im using a UI5 extend and I need that when I click on the button it will add new entry of the text and dropDownBox,

The button should be one only and in button click the text and DDB should be added as new controls to the UI,how   I can do that currently?

Thanks

Miley

JS Bin - Collaborative JavaScript Debugging

Accepted Solutions (1)

Accepted Solutions (1)

karthikarjun
Active Contributor
0 Kudos

Will this help?

http://jsbin.com/limenu/edit?js,output

It is a sample example for you.

Thanks,

Karthik A

Former Member
0 Kudos

HI Karthik,

I need the combination of what you have created with the extend and what albert did...

Button on top and when you click you add new entry of text and list box.

can you assist please how to do it right?

Many thanks,

Miley

Former Member
0 Kudos

HI All,

Could I get some help with this please?

Thanks,

Miley

former_member182862
Active Contributor
0 Kudos
Former Member
0 Kudos

HI Dennis,

Thank you!

1. Just to clarify what is the reason that you create two controls?

2.is it possible to put the add and remove inside the control itself and not to call it from outside

when using the new...?

3.what is the reason for the following, this is just for the first init versions before clicking on add?

list.setModel(new sap.ui.model.json.JSONModel([]));

Best regards,

Miley

former_member182862
Active Contributor
0 Kudos

HI Miley

1. I do not see that we can have a clean implementation with only one control.

2. I will not advocate this. Controls are built so that they have no business logic.

3. this is to initialize the default model of the list to an empty array. You can try initialize it with

list.setModel(new sap.ui.model.json.JSONModel([{

   {text: 'Example', value: 'A'}

}]));


Thanks

-D

Answers (2)

Answers (2)

SergioG_TX
Active Contributor
0 Kudos

Miley, are you thinking of a data driven UI ? it is possible, you need to know the control type, and its properties. in your db you would need to have tables that contain those properties. when you get that data in the ui, you will have constructors that will perform the creation of those controls and somehow you will need to know how to place those controls in the UI (placement on the screen - possibly a predefined form) I did a similar example for a form that contained: Label    InputField/DropDown  (this would repeat X times depending on the data I retrieved from the DB) and at the bottom of my form I had a submit button ( that post to the DB ) and a cancel button (to close my form) It is achievable but you need to think of a data driven design here

Former Member
0 Kudos

Hi,

Would something like this help: JS Bin - Collaborative JavaScript Debugging ?

It's not like your example custom control. But it won't be to difficult to change it so that it can work in a custom control.

Regards.

Former Member
0 Kudos

HI Albert,

Thank you very much, this is almost.

1.how you would integrate with extend of UI5 (new control like my example)

2. I cannot use the sap.m lib just common or core

3. how can I add spaces between the control , currently they are Linked...



Many thanks !

Miley