Page 1 of 1

Assign toggle value from JSON

Posted: Sun Apr 28, 2013 4:40 pm
by Andrés Méndez

Hello.

I receive a list of items from a JSON, and I show them as a list in a page. Each item has a boolean value, and I want to assign it to a toggle element in my Appery project.

The problem is that the toggle item only has a value of Visible. I suppose that I must store the boolean value in a local variable, and using Javascript modify the status of the toggle to show if it is On or Off.

But I don't know how to change the status of the toggle using Javascript, and to do it for each item in the list.

Thanks in advance.


Assign toggle value from JSON

Posted: Sun Apr 28, 2013 8:03 pm
by Illya Stepanov

Hi Andrés, we will look for a solution. We'll update.


Assign toggle value from JSON

Posted: Mon Apr 29, 2013 7:49 am
by Kateryna Grynko

Hi Andrés,

It's a bug, will be fixed. As a workaround you can map to "Visible" property. Then in front of the property click "Add JS" and add the following code to change Toggle component value:
codevar toggleValue = value ? "on" : "off&quot
element.val(toggleValue).refresh();

return true;/code


Assign toggle value from JSON

Posted: Mon Apr 29, 2013 6:37 pm
by Andrés Méndez

Hello Katya.

The workaround worked :-) I wish you fix it soon.

Meanwhile I want to specify also a text (not just "On" or "Off"), I've tried this, but didn't work:
code
var toggleValue = value ? "on" : "off&quot
element.val(toggleValue).refresh();

var toggleText = value ? "Reservado" : "Reservar&quot
element.val(toggleText).refresh();

return true;
/code


Assign toggle value from JSON

Posted: Mon Apr 29, 2013 8:24 pm
by Maryna Brodina

Hello! Please take a look here https://getsatisfaction.com/apperyio/...


Assign toggle value from JSON

Posted: Thu May 02, 2013 9:38 pm
by Rafael Martínez

Is there an expected date for the fix?


Assign toggle value from JSON

Posted: Thu May 02, 2013 9:54 pm
by maxkatz

June time frame.