PDA

View Full Version : RowEditor Grid with Combo box - too much recursion



murkrishna
23 Apr 2010, 2:17 AM
Hi,

I am trying to create a grouping grid with roweditor.

In that one column has a combo box and data is getting loaded from the database.
I was able to load a combo in the row editor and the data into the combo.
While i try to press the update button i get an error "too much recursion"

Can any one help me how can i over come this issue?

Here i am pasting my code for your reference.




Ext.onReady(function(){

Ext.QuickTips.init();

var modulesinfo = Ext.data.Record.create([{
name: 'modulename',
type: 'string'
}, {
name: 'ismenu'
}, {
name: 'submoduleto',
type: 'string'
},{
name: 'url',
type: 'string'
}]);

var writer = new Ext.data.JsonWriter({
encode: true,
writeAllFields: true // write all fields, not just those that changed
});

var proxy = new Ext.data.HttpProxy({
api: {
read : indexurl+"admin/getallmoduleinfo",
create : indexurl+"admin/addmoduleinfo",
reload: indexurl+"admin/updatemoduleinfo",
destroy: indexurl+"admin/deletemoduleinfo"
},
method: 'POST'
});

var modulesstore = new Ext.data.GroupingStore({
proxy: proxy,
autoSave: true,
reader: new Ext.data.JsonReader ({
root: 'modulesinfo',
totalProperty: 'totalCount',
idProperty: 'id',
remoteSort: false,
fields: modulesinfo,
messageProperty: 'message',
successProperty: 'success'
}),
id: 'id',
writer: writer,
sortInfo: {field: 'modulename', direction: 'ASC'},
groupField:'submoduleto'
});

var modules_editor = new Ext.ux.grid.RowEditor({
saveText: 'Update',
listeners: {
afteredit: function(object, changes, r, rowIndex) {
modulesstore.reload();
}
}
});

var submoduleto_combostore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: indexurl+"admin/getallmodulename",
method: 'POST'
})
, reader: new Ext.data.JsonReader({
id: 'id'
, root: 'modulenamelist'
}
, [
{name: 'module_id'},
{name: 'module_name'}
])
});
modulesstore.load();
var submoduleto_combo = new Ext.form.ComboBox({
store:submoduleto_combostore,
typeAhead: true,
triggerAction: 'all',
listClass: 'x-combo-list-small',
id:'submodule_to',
name:'submodule_to',
displayField:'module_name',
valueField:'module_id'
});
submoduleto_combostore.load();

var modulesgrid = new Ext.grid.GridPanel({
store: modulesstore,
width:700,
height:400,
title:'Modules List',
padding: '0 0 0 0',
margins: '0 5 5 5',
autoExpandColumn: 'modulename',
plugins: [modules_editor],
view: new Ext.grid.GroupingView({
markDirty: false
}),
tbar: [{
iconCls: 'icon-user-add',
text: 'Add Employee',
handler: function(){
var e = new modulesinfo({
modulename: '',
ismenu: '',
submoduleto: '',
url: ''
});
modules_editor.stopEditing();
modulesstore.insert(0, e);
modulesgrid.getView().refresh();
modulesgrid.getSelectionModel().selectRow(0);
modules_editor.startEditing(0);
}
},{
ref: '../removeBtn',
iconCls: 'icon-user-delete',
text: 'Remove Employee',
disabled: true,
handler: function(){
modules_editor.stopEditing();
var s = modulesgrid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
modulesstore.destroy(r);
}
}
}],
columns:[
new Ext.grid.RowNumberer(),
{
id:'modulename',
header: 'Module Name',
dataIndex: 'modulename',
menuDisabled: true,
width: 40,
editor: {
xtype: 'textfield',
allowBlank: false
}
},{
id: 'ismenu', // +X+ ADDED for autoExpandColumn (below)
header: 'Is Menu',
dataIndex: 'ismenu',
menuDisabled: true,
editor: {
xtype: 'radiogroup',
allowBlank: false,
fieldLabel: 'Auto Layout',
items: [
{boxLabel: 'Yes', name: 'ismenu', inputValue: 'Y'},
{boxLabel: 'No', name: 'ismenu', inputValue: 'N'}
]
}
},{
id:'submoduleto',
header: 'Sub Module to',
dataIndex:'submoduleto',
menuDisabled: true

, editor: {
allowBlank : true,
displayField : 'module_name',
emptyText : 'Select Module',
forceSelection : true,
lazyRender : true,
mode : 'remote',
name : 'submoduleto',
store : submoduleto_combostore,
typeAhead : true,
triggerAction : 'all',
valueField : 'module_id',
xtype : 'combo'
}

},{
id:'url',
header: 'URL',
dataIndex:'url',
menuDisabled: true,
editor: {
xtype: 'textfield',
allowBlank: true
}
}
]
});

modulesgrid.render('admin_modules_panel');
});



Regards
Murali krishna

murkrishna
25 Apr 2010, 11:56 PM
The error is due to the radiogroup used in editor.

Can any one able to help me how this can be fixed?

murali

igitur
19 Jul 2010, 8:53 AM
I'm having exactly the same problem. There seems to be a fix here:
http://www.sencha.com/forum/showthread.php?94031-Ext3.1-Radio-Group-I-wonder-if-its-a-bug

But I'm using the new Ext.NET so I don't have access to the underlying ExtJS code.