PDA

View Full Version : [3.2] Checkboxgroup don't load checks



Perfect Lion
9 Apr 2010, 8:41 AM
Hi staff,

I'm loading the data in my form with method .load of BasiForm, the data is loaded but my checksbox don't load. It is would a bug?

code:


{
xtype: 'form'
, items: [
...
{
xtype: 'checkboxgroup'
, items: [
{boxLabel: '10%', name: 'event[pay_10]', value: true}
, {boxLabel: '40%', name: 'event[pay_40]', value: true}
, {boxLabel: 'Pay Total', name: 'event[pay_total]', value: true} ]
}
, reader: new Ext.data.JsonReader({
root: 'data'
, fields: [
{name: 'evento[pay_10]', mapping: 'pay_10'}
, {name: 'evento[pay_40]', mapping: 'pay_40'}
, {name: 'evento[pay_total]', mapping: 'pay_total'}
]
})
...
]
}


My Json:


{success: true, data:{
pay_10: true
, pay_40: true
, pay_total: false
}}


I try convert the value true for check in my read ex:



new Ext.data.JsonReader({
root: 'data'
, fields: [
{name: 'evento[pay_10]', mapping: 'pay_10', convert: function(v){return (v)? 'check': null}}
, {name: 'evento[pay_40]', mapping: 'pay_40', convert: function(v){return (v)? 'check': null}}
, {name: 'evento[pay_total]', mapping: 'pay_total', convert: function(v){return (v)? 'check': null}}
]
})


But is don't working, too

Perfect Lion
9 Apr 2010, 9:39 AM
I create a workaround that in Brazil this is known with POG (Programing Oriented Gambier) :P

In my checkbox i set the id for ex:



...
{boxLabel: '10%', name: 'event[pay_10]', value: true, id: 'event[pay_10]'}
, {boxLabel: '40%', name: 'event[pay_40]', value: true, id: 'event[pay_40]'}
, {boxLabel: 'Pay Total', name: 'event[pay_total]', value: true, id: 'event[pay_total]'}
...


And in my Reader:


...
, reader: new Ext.data.JsonReader({
root: 'data'
, fields: [
{name: 'evento[pay_10]', mapping: 'pay_10', convert: function(v){ Ext.getCmp('evento[pay_10]').setValue(v); }}
, {name: 'evento[pay_40]', mapping: 'pay_40', convert: function(v){ Ext.getCmp('evento[pay_40]').setValue(v); }}
, {name: 'evento[pay_total]', mapping: 'pay_total', convert: function(v){ Ext.getCmp('evento[pay_total]').setValue(v); }}
]
});
...


=D

More I not like this workaround =(

Perfect Lion
12 Apr 2010, 10:41 AM
*UP*