View Full Version : checked:true for checkbox did not work

16 May 2017, 5:56 AM

sometimes it is better to stay in bed :-)
I do not get working this easy stuff and do not know why

For default, the checkbox schould be activated. But it does not work :-((

var fields = [
xtype: 'textfield',
name: 'to',
fieldLabel: me.snippets.to
xtype: 'textfield',
name: 'subject',
fieldLabel: me.snippets.subject
xtype: 'panel',
bodyStyle: 'padding-left:105px;padding-top:3px;background:#f0f2f4;padding-bottom:6px;color:black !important;',
border: false,
items: [
xtype: 'checkbox',
name: 'sendInvoice',
checked: true,
cls: Ext.baseCSSPrefix,
boxLabel:'<strong>{s name=attach_invoice}xxxxx{/s}</strong>',
autoHeight: true,
inputValue: true,

Gary Schlosberg
16 May 2017, 3:37 PM
Can I ask why you are putting the checkbox within a panel? To what are you passing the 'fields' array?

16 May 2017, 9:59 PM

I am a newby in ExtJs. There was a panel with mail forms. So I tried to extend it with a a checkbox field.

Gary Schlosberg
17 May 2017, 3:50 PM
Does it work if you place it into the array like the other fields? If not, can you share more of your code?

17 May 2017, 7:54 PM
Your code snippet seems working fine with version 4.2.1, please share your fiddle.



18 May 2017, 12:49 AM
I got it.

the field in the model was set like this

{ name: 'sendInvoice', type:'boolean'},

I set it to

{ name: 'sendInvoice', type:'boolean', defaultValue: true },

Gary Schlosberg
18 May 2017, 3:58 PM
Glad to hear you got it working, and thanks for sharing the solution with the community.