Jordi Niubo
Posts: 0
Joined: Tue Nov 26, 2013 12:08 pm

Put options in Select Component

Hi,

I have a Select component but I need to have the options taken from my database.

I can have all the options with one service, but how I can put all these in the Select component?

Thanks

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Put options in Select Component

Hello Jordi,

You should map response parameters of your DB service to this select component: http://docs.appery.io/documentation/r...

Jordi Niubo
Posts: 0
Joined: Tue Nov 26, 2013 12:08 pm

Put options in Select Component

ok thanks, this work!

Jordi Niubo
Posts: 0
Joined: Tue Nov 26, 2013 12:08 pm

Put options in Select Component

Hi,

In the Select component need to create string Label with 2 parameters of the Response.

In the documentation http://devcenter.appery.io/documentat... this work with a simple label, but with Select component i have some problems, I don't know the name of the select value with the relatined value. How i can do this?

Thanks

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Put options in Select Component

Hi Jordi,

Not sure I understand you.

[quote:]I don't know the name of the select value with the relatined value. How i can do this? [/quote]

What do you mean here? Could you please post a screenshot?

Jordi Niubo
Posts: 0
Joined: Tue Nov 26, 2013 12:08 pm

Put options in Select Component

Hi, i have a service that give me 3 Strings. (id, name and number)
I need to put these 3 Strings in a Select component. In the value the Id and in the label a new string like (name+" have number "+ number).
With the documentation, the mapping use JS. When I put the 2 items to the Label and make new js like:

return Appery("name ").val() +" have number "+ Appery("number").val();

This give me errors, undefined elements.
If I save in a local variable like this: http://devcenter.appery.io/documentat...

Possible will work, but i don't know the Select element that have the correct id

Can u help me?

Thanks

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Put options in Select Component

Hello Jordi,

You need to map field "id" from service to "value" property of selectmenu,
then map field "name" and "number" to property "label" and create js code for mapping:

codeif (value != undefined){
return element.text() + ' ' + value;
}
else{
return element.text();
}/code

Jordi Niubo
Posts: 0
Joined: Tue Nov 26, 2013 12:08 pm

Put options in Select Component

Hi

This work, but i need to show more information like this.

This JS is called 2 times and only concatenate the 2 values.

There are any other option to create a correct string like name+" have number "+ number?

thanks for your time

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Put options in Select Component

Hello,

You can add JS handler to mappingа $[] on selectmenu, where set line that you want with the code:
pre
$(element).val(value.name+" have number "+ value.number);/pre

Return to “Issues”