PDA

View Full Version : Checkboxgroup and Checkboxes in TabPanels



squalo
3 Mar 2011, 3:01 AM
unfortunately stucking again for days on this Ext JS problem, i'll desperately hope to get some help here.

I got three different stores in which I create some TabPanels with Checkboxes on their loading events.



storeBitConfiguration.on('load', function (myStore, records, options) {
myStore.each(function (record) {
storeBitConfigs.loadData(record.node,record.get('Size'));
});
});

storeBitConfigs.on('load', function (myStore, records, options) {
var SizeOfCfgs=options.add;
BitCfgCheckboxGroup = new Array(SizeOfCfgs);
myStore.each(function (record,index) {
BitCfgCheckboxGroup[index] = new Ext.form.CheckboxGroup({
id:'BitCfgCheckboxGroup_' + index,
xtype: 'checkboxgroup',
itemCls: 'x-check-group-alt',
border: false,
autoHeight: true,
// Put all controls in a single column with width 100%
columns: 4,
vertical: true,
items: [],
});
// Next, load all the bits first
storeBits.loadData(record.node,index);
// then add the certain Configtabs to the panel
ConfigTabs.add({
title: record.get('Name'),
tabTip: record.get('Name'),
id: index + 1,
closable: false,
iconCls: record.get('Icon'),
items: BitCfgCheckboxGroup[index],
});
});
ConfigTabs.setActiveTab(0);
});

storeBits.on('load', function (myStore, records, options) {
var iCfg=options.add;
myStore.each(function (record,iBit) {
var BitId= 'Bit' + iCfg + '_' + iBit;
var BitCheckBox = new Ext.form.Checkbox({
boxLabel: (record.data.INDICATOR?record.data.INDICATOR:'Bit#'+ record.data.Bit),
qtip: record.data.LEGEND, // qtip: when using field override above; tooltip: when using Saki's ux.XCheckbox Extension
xtype: 'checkbox', // xtype: xcheckbox for using Saki's ux.XCheckbox Extension
name: record.data.CName,
id: BitId,
labelStyle: 'font-weight:normal;',
disabled: (record.data.CName?false:true),
});
BitCfgCheckboxGroup[iCfg].items[iBit] = BitCheckBox;
});
});


Afterwards I'm trying to check/uncheck these certain Checkboxes through a rowselect listener in a Gridpanel with a RowSelectionModel.



...
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec) {
storeBitConfigs.each(function (record,j) {
var dword=eval('storeVehicles.getAt(row).data.Config' + (j+1));
var x=parseInt(dword,16);
var amount = record.get('Size');
for(i=(amount-1); i>=0 ; --i) {
var BitCfgCheckbox = Ext.getCmp('Bit' + j + '_' + i);
if(BitCfgCheckbox) {
if((x >> i) & 1) {
BitCfgCheckbox.checked=true;
} else {
BitCfgCheckbox.checked=false;
}
}
}
});
}
}
}),

...
My Problem is, that the first, focused TabPanel never gets the checkboxes checked.
And even I can't get them changed correctly while switching to another row. It seemed that the assignment of the Checkbox IDs ist getting lost or somehow.
Maybe also my apporach for this solution is wrong.

Any help is (very) appreciate.
Thx.

squalo
3 Mar 2011, 5:41 AM
Sorry for stessing this forum with one topic more.
Meanwhile I got it fixed and this can be removed.

it was


BitCfgCheckbox.setValue(true);

instead of


BitCfgCheckbox.checked=true;

... but wondering now how it got checked some boxes at all....