May 14, 2012, 6:03 PM
[CLOSED] Loading a FormPanel that contains a SelectBox
Hi folks, i have an automatization that generates the interface and flush it for rendering. But when i try to flush a FormPanel that contains a SelectBox, the ExtJs throws an exception when it tries to rewrite namespaces (Ext.ClassManager.parseNamespace - http://docs.sencha.com/ext-js/4-0/so...t-ClassManager) .
1 - Panel where FormPanel is gonna be rendered
The following code works because the FormPanel does not have a SelectBox inside.
1 - Panel where FormPanel is gonna be rendered
<ext:Viewport ID="Viewport1" Layout="BorderLayout" Border="false" runat="server">
<Items>
<ext:Panel ID="Panel1" Region="Center" runat="server" Title="PNL">
<Loader ID="Loader1" runat="server" AutoLoad="true" Mode="Component" Url="/Example/TestSelectBox/">
<LoadMask ShowMask="true" />
</Loader>
</ext:Panel>
</Items>
</ext:Viewport>
2 - Result of interface generationpublic ActionResult TestSelectBox()
{
string str = "{bin:[Ext.create(\"Ext.data.Store\",{model:Ext.define(Ext.id(), {extend: \"Ext.data.Model\", fields:[{name:\"ID\",mapping:\"ID\"},{name:\"TipoDeRegistro\",mapping:\"TipoDeRegistro\"}] }),storeId:\"_elpFormularioDeAtualizacao_store\",proxy:{data:[],type:'memory'}})],id:\"_elpFormularioDeAtualizacao\",xtype:\"form\",defaults:{\"msgTarget\":\"side\"},items:[{xtype:\"textfield\",anchor:\"100%\",fieldLabel:\"ID\",name:\"ID\",readOnly:true},{xtype:\"selectbox\",anchor:\"100%\",fieldLabel:\"TipoDeRegistro\",name:\"TipoDeRegistro\",allowBlank:false,queryMode:\"local\",triggerAction:\"all\"}]}";
return new ContentResult { Content = str };
}
3 - A better view of generated code{
bin: [Ext.create("Ext.data.Store", {
model: Ext.define(Ext.id(), {
extend: "Ext.data.Model",
fields: [{
name: "ID",
mapping: "ID"
}, {
name: "TipoDeRegistro",
mapping: "TipoDeRegistro"
}]
}),
storeId: "_elpFormularioDeAtualizacao_store",
proxy: {
data: [],
type: 'memory'
}
})],
id: "_elpFormularioDeAtualizacao",
xtype: "form",
defaults: {
"msgTarget": "side"
},
items: [{
xtype: "textfield",
anchor: "100%",
fieldLabel: "ID",
name: "ID",
readOnly: true
}, {
xtype: "selectbox",
anchor: "100%",
fieldLabel: "TipoDeRegistro",
name: "TipoDeRegistro",
allowBlank: false,
queryMode: "local",
triggerAction: "all",
store: [
["Visao", "Visao"],
["Menu", "Menu"],
["Acesso", "Acesso"],
["Pagina", "Pagina"]
]
}]
}
The code above throws the exception mentioned on the beginning of this post.The following code works because the FormPanel does not have a SelectBox inside.
public ActionResult TestSelectBox()
{
string str = "{bin:[Ext.create(\"Ext.data.Store\",{model:Ext.define(Ext.id(), {extend: \"Ext.data.Model\", fields:[{name:\"ID\",mapping:\"ID\"},{name:\"TipoDeRegistro\",mapping:\"TipoDeRegistro\"}] }),storeId:\"_elpFormularioDeAtualizacao_store\",proxy:{data:[],type:'memory'}})],id:\"_elpFormularioDeAtualizacao\",xtype:\"form\",defaults:{\"msgTarget\":\"side\"},items:[{xtype:\"textfield\",anchor:\"100%\",fieldLabel:\"ID\",name:\"ID\",readOnly:true}]}";
return new ContentResult { Content = str };
}
{
bin: [Ext.create("Ext.data.Store", {
model: Ext.define(Ext.id(), {
extend: "Ext.data.Model",
fields: [{
name: "ID",
mapping: "ID"
}, {
name: "TipoDeRegistro",
mapping: "TipoDeRegistro"
}]
}),
storeId: "_elpFormularioDeAtualizacao_store",
proxy: {
data: [],
type: 'memory'
}
})],
id: "_elpFormularioDeAtualizacao",
xtype: "form",
defaults: {
"msgTarget": "side"
},
items: [{
xtype: "textfield",
anchor: "100%",
fieldLabel: "ID",
name: "ID",
readOnly: true
}]
}
Any idea to overcome this problem?
Last edited by Daniil; May 15, 2012 at 11:56 AM.
Reason: [CLOSED]