PDA

View Full Version : Checked checkBox from JSON



chuvinha
26 Jan 2011, 9:00 AM
Hi guys, I am not able to checked the checkBox from JSON.
I tried to put "checked=true" but it wasn't work.



{"total":240,"linhas":[{"checked":true,"idTerritorio":1,"nome":"Mundial"},{"checked":false,"idTerritorio":2,"nome":"Resto do Mundo"}]}


Could someone help me?

httpdotcom
26 Jan 2011, 10:05 AM
checkbox.checked (http://dev.sencha.com/deploy/dev/docs/source/Checkbox.html#cfg-Ext.form.Checkbox-checked) is a configuration option that says whether the checkbox should show initially checked.
checkbox.value (http://dev.sencha.com/deploy/dev/docs/source/Field.html#cfg-Ext.form.Field-value) is what decides whether a checkbox is "on" or "off".
checkbox.getValue() (http://dev.sencha.com/deploy/dev/docs/source/Checkbox.html#method-Ext.form.Checkbox-getValue) also returns the components checked state.

valititi
26 Jan 2011, 4:06 PM
and try to see your store how is defined (me, i have set it to int-s because my booleans types (beeing in a old mysql engine) are in fact tinyint-s. And I consider 1=true, 0=false. And my checked boxes works ok... It seems that 1 means "on" for Ext, but true not means "on"... ?! see database, and store... good luck