Lux Smith
Posts: 0
Joined: Fri Jan 10, 2014 4:52 am

How to hide an option of a selectmenu during mapping of a service?

I am using a selectmenu and have mapped a database service to populate the drop down options, but need to skip a couple of options based on some criteria. I have tried to add javascript in the selecmenu mapping but it does not seem to work. Thanks.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to hide an option of a selectmenu during mapping of a service?

Hi Lux,

If you want to do this in Select component mapping, you can use: pre$(element).hide();/preOr anywhere in your app:pre$(Appery("mobileselectmenu").find("option")).hide();/preWhere 'mobileselectmenu' is a name of Select component,
'i' is a number of component option.

Lux Smith
Posts: 0
Joined: Fri Jan 10, 2014 4:52 am

How to hide an option of a selectmenu during mapping of a service?

Sorry, I am not able to use either of these code snippets to hide a select option. I need to hide an option based on a specific option value. During Select component data mapping I tried to use the $(element).hide(); and it didn't work. Then I tried to use the second snippet in the success event of the service and that also didn't work.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to hide an option of a selectmenu during mapping of a service?

Hello,

Another way is exclude this elements from service response using DB query. Could you show us your service response values and values which you want to exclude.

Lux Smith
Posts: 0
Joined: Fri Jan 10, 2014 4:52 am

How to hide an option of a selectmenu during mapping of a service?

Image

I am storing a userId in a localstore variable
var userId = localStorage.getItem("_id");

And would like to hide this userID when the select menu is populated upon load event of the screen. I am matching it against the "_id" in the response.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to hide an option of a selectmenu during mapping of a service?

What you need to do is :

Return to “Issues”