cntop@msn.com
6 Nov 2012, 8:09 PM
due to the dynamic module consideration, i must output ext code in json block.
this time i want to add combobox into a grid column dynamically, the extjs code fragment like this
var grid = Ext.create('Ext.grid.Panel', {
...
store: store,
columns: eval(myJson.columnModel),
width: 95,
...
})
"myJson" had gotten from Ext.Ajax.request Correctly.
the json code come from server like this
"columnModel": [
{
"head": "testnum",
"dataIndex": "number",
"editor": "Ext.create('Ext.form.field.ComboBox',{typeAhead: true,triggerAction: 'all',selectOnTab: true,store: [['1','admin'],['2','demo'],['3','member'],['4','leader'],['35','cd1'],['36','1333'],['37','111'],['38','www'],['39','1221']],lazyRender: true,listClass: 'x-combo-list-small'})"
}
but the console report error "Error: [Ext.createByAlias] Cannot create an instance of unrecognized alias: widget.Ext.create('Ext.form.field.ComboBox',{......"
"columns: eval(myJson.columnModel)" does not work, why?
thx for your help.
this time i want to add combobox into a grid column dynamically, the extjs code fragment like this
var grid = Ext.create('Ext.grid.Panel', {
...
store: store,
columns: eval(myJson.columnModel),
width: 95,
...
})
"myJson" had gotten from Ext.Ajax.request Correctly.
the json code come from server like this
"columnModel": [
{
"head": "testnum",
"dataIndex": "number",
"editor": "Ext.create('Ext.form.field.ComboBox',{typeAhead: true,triggerAction: 'all',selectOnTab: true,store: [['1','admin'],['2','demo'],['3','member'],['4','leader'],['35','cd1'],['36','1333'],['37','111'],['38','www'],['39','1221']],lazyRender: true,listClass: 'x-combo-list-small'})"
}
but the console report error "Error: [Ext.createByAlias] Cannot create an instance of unrecognized alias: widget.Ext.create('Ext.form.field.ComboBox',{......"
"columns: eval(myJson.columnModel)" does not work, why?
thx for your help.