PDA

View Full Version : how to get the checkbox value from dynamic checkbox after submit?



weige215
9 Aug 2012, 5:57 AM
this my code:


var rolesAddPanel = Ext.create('Ext.form.Panel', {
...
items: [{
width: 950,
xtype: 'fieldset',
id: 'rolesAddPanelFieldset',
title: 'base info',
border: false,
items: [{
layout: 'column',
border: false,
items:[
...
{
columnWidth: .20,
border: false,
height: 260,
autoScroll: true,
bodyStyle: 'background-color:#dfe8f5;',
items:[{
xtype: 'treepanel',
id: 'menusTree',
title: '?????',
rootVisible: false,
store : Ext.create('Ext.data.TreeStore', {
model: 'menusTreeModel',
<?php echo $checkedTree;?>
}),

listeners:{
'checkchange': function (node, checked) {
node.cascadeBy(function (child) {
child.set("checked", checked);
});

var selNodes = Ext.getCmp("menusTree").getChecked();
var checkNodes = new Array();
var i = 0;
Ext.each(selNodes, function(node){
checkNodes[i] = node.id.substring(21, node.id.length);
i += 1;
});

Ext.Ajax.request({
url: '...',
params: {
selTreeNodes: Ext.JSON.encode(checkNodes)
},
success: function(xhr) {
Ext.getCmp('operationsList').items.each(function(item){
if(item.getId() != 'operations_select'){
Ext.getCmp('operationsList').remove(item);
}
});

eval(xhr.responseText);
Ext.getCmp('operationsList').doLayout();
},
failure: function(xhr) {
...
}
});
...
}
return rolesAddPanel;

xhr.responseText is
Ext.getCmp('operationsList').items.add(new Ext.form.Checkbox({
boxLabel: "aaa",
name: "aaa",
inputValue: "a1"}));

i have add checkbox dynamically, but submit the formPanel, can't get the checkbox value.
in post variable have not 'aaa'. after submit, how to get the checkbox value?