Reputation: 13
I am new to Senchatouch and am struggling to get a value of Check box field. i know to get the value of single Check box field but i need to get the values of the selected Check box field and moreover I need to pass the value to the json data. Any help would be much appreciated. thanks in advance.
here is my code follows:
{
xtype:'panel',
id:'panel1',
items:[
{
xtype:'panel',
id:'pan1',
hidden:true,
layout:'vbox',
items:[
{
xtype: 'checkboxfield',
id:'day1',
value: 'day1',
label: 'day1',
labelAlign: 'right',
labelWidth: '90%',
listeners:{
check:function()
{
var a=Ext.getCmp('day1').getValue();
localStorage.setItem("day1" ,a);
},
},
},
{
xtype: 'checkboxfield',
id:'day2',
value: 'day2',
label: 'day2',
labelAlign: 'right',
labelWidth: '90%',
},
{
xtype: 'checkboxfield',
value: 'day3',
id:'day3',
label: 'day3',
labelAlign: 'right',
labelWidth: '90%',
},
]
},
]
},
},
Upvotes: 1
Views: 1117
Reputation: 6365
Ext.ComponentQuery.query("checkboxfield{isChecked()}");
should return all checkbox fields.
I think you should know what to do then.
Update: if you don't want to process each single checkbox field, it's easy to do it programmatically, like this:
for (var i=1;i<=3;i++){
(function(index){
var id = 'day' + index.toString();
var component = Ext.getCmp(id);
localStorage.setItem(id, component.getValue());
}(i);
}
getting values from localstorage programmatically is similar.
Upvotes: 1