Results 1 to 3 of 3

Thread: [3.2] Checkboxgroup don't load checks

  1. #1

    Default [3.2] Checkboxgroup don't load checks

    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:
    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:
    Code:
    {success: true, data:{
    	pay_10: true
            , pay_40: true
            , pay_total: false
    }}
    I try convert the value true for check in my read ex:

    Code:
    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

  2. #2

    Default

    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:

    Code:
    ...
    {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:
    Code:
    ...
    , 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 =(

  3. #3

    Default

    *UP*

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •