Page 2 of 2

Change words on toggle component

Posted: Mon May 06, 2013 3:37 am
by maxkatz

Can you post a screen shot of your mapping?


Change words on toggle component

Posted: Mon May 06, 2013 5:28 am
by Andrés Méndez

Hello Max.

My app is shared with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a, so you can see the entire app.

The code of this problem is in the page "Lista_Regalos".

Thanks.


Change words on toggle component

Posted: Mon May 06, 2013 8:19 pm
by maxkatz

Service JSON:

Image

Service mapping:

Image

JavaScript:

Image

Result:

Image


Change words on toggle component

Posted: Tue May 07, 2013 5:31 am
by Andrés Méndez

Hello Max.

Thanks for the good explanation, but that part already works for me, but there is not my problem, my problem is to show not "On" or "Off" in a toggle but, for example, "Enabled" or "Disabled" (or "Yes" and "No" as Michael originally asked).

That's what I haven't been able to make it work, to show different words than "On" or "Off".

Thanks.


Change words on toggle component

Posted: Tue May 07, 2013 12:32 pm
by Oleg Danchenkov

Hi Andrés.
Try this code in mapping to toggle element
codeelement.parent().find(".ui-slider-label-a").text("Disabled");
element.parent().find(".ui-slider-label-b").text("Enabled");
var toggleValue = (value ? "on" : "off");
element.val(toggleValue).refresh();
return true;
/code
This code changes labels on toggle element. Values still will be "on/off"


Change words on toggle component

Posted: Tue May 07, 2013 9:58 pm
by Andrés Méndez

That's it Oleg, now it works!

My fault was that I was using the code of
codeelement.parent().find(".ui-slider-label-a").text("Disabled");
element.parent().find(".ui-slider-label-b").text("Enabled");/code
in page load, not in the JSON mapping.

Thanks for your solution!