Feb 19, 2015, 6:18 PM
[FIXED] [#729] [3.1.0] Ext.data.schema.Schema Duplicate class name error
I have some c# code that generates the following javascript to define a popup window
Thanks
"new Ext.window.Window({height:750,renderTo:Ext.net.ResourceMgr.getRenderTarget(),width:950,autoScroll:true,items:[{xtype:"tabpanel",items:[{store:{model:Ext.define("EPEntityIDModel", {extend: "Ext.data.Model", fields:[{name:"EntityIDIDN",type:"string"},{name:"SourceID",type:"string"},{name:"EffectiveDate",type:"string"},{name:"EntityDefinitionID",type:"string"},{name:"EntityIDDefinitionID",type:"string"},{name:"ValueInt",type:"string"},{name:"ValueAlphaNumeric",type:"string"},{name:"RecordStatus",type:"string"},{name:"RowInsertUserID",type:"string"},{name:"RowInsertDateTime",type:"string"},{name:"RowUpdateUserID",type:"string"},{name:"RowUpdateDateTime",type:"string"},{name:"RowEffectiveDate",type:"string"}] }),autoLoad:true,pageSize:50,proxy:{type:"ajax",extraParams:{"gridPanelID":"73","fieldName":"EntityID.EntityDefinitionID","fieldValue":21},reader:{type:"json",rootProperty:"data"},timeout:3000000,url:"/GridPanelCommon/GridPanelCommonProxyWWC"},remoteSort:true},id:"EPEntityIDGridPanel",height:150,margin:"2 2 2 2",plugins:[window.App.id4868c60d65a8c3f={ptype:"rowediting",directEvents:{edit:{fn:function(item,e){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/GridPanelCommonEditDS",extraParams:{"record":e.record.data,"gridPanelID":"73"},userSuccess:function(response,result,el,type,action,extraParams,o){App.EPEntityIDGridPanel.getStore().load();},control:this,action:'Edit'});}}}}],width:780,xtype:"grid",bbar:{xtype:"pagingtoolbar",items:[{iconCls:"#Add",text:"Add Record",listeners:{click:{fn:function(item,e){ var grid = App.EPEntityIDGridPanel; grid.editingPlugin.cancelEdit(); // Create a record instance through the ModelManager var r = Ext.create('EPEntityIDModel', { EntityIDIDN:'', SourceID:'', EffectiveDate:'', EntityDefinitionID:'', EntityIDDefinitionID:'', ValueInt:'', ValueAlphaNumeric:'', RecordStatus:'', RowInsertUserID:'', RowInsertDateTime:'', RowUpdateUserID:'', RowUpdateDateTime:'', RowEffectiveDate:'' }); grid.store.insert(0,r); grid.editingPlugin.startEdit(0,0); }}}},{iconCls:"#PageExcel",text:"Export",listeners:{click:{fn:function(item,e){GridPanelExport(App.EPEntityIDGridPanel, 'xls');}}}},{iconCls:"#Cog",directEvents:{click:{fn:function(item,e){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/GridPanelFieldConfigPopup",extraParams:{"gridPanelConfigID":"73"},control:this});}}}},{iconCls:"#DatabaseKey",directEvents:{click:{fn:function(item,e){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/GridPanelDataDictionaryPopup",extraParams:{"gridPanelConfigID":"73"},control:this});}}}}],displayInfo:true,store:"ide3901ac4c5910c3f"},columns:{items:[{hidden:true,width:45,xtype:"numbercolumn",align:"right",dataIndex:"EntityIDIDN",menuText:"IDN",text:"IDN",tooltip:"EntityIDIDN",format:"#"},{hidden:true,width:100,xtype:"numbercolumn",align:"right",dataIndex:"SourceID",editor:{xtype:"numberfield",decimalSeparator:"."},menuText:"SourceID",text:"SourceID",tooltip:"SourceID",format:"#"},{width:100,xtype:"datecolumn",align:"center",dataIndex:"EffectiveDate",editor:{xtype:"datefield",format:"m-d-Y",submitFormat:"n/j/Y"},menuText:"Effective Date",text:"Effective Date",tooltip:"EffectiveDate",format:"m-d-Y"},{width:229,xtype:"templatecolumn",dataIndex:"EntityDefinitionID",editor:{xtype:"combobox",valueField:"value",store:{model:Ext.define(Ext.id(), {extend: "Ext.data.Model", fields:[{name:"text",type:"string"},{name:"value",type:"string"}] }),pageSize:50,proxy:{type:"ajax",extraParams:{"sql":"SELECT EntityDefinitionID, EntityName FROM Core.EntityDefinition","codeNameID":"0"},reader:{type:"json",rootProperty:"data"},url:"/GridPanelCommon/GetComboItems"},remoteFilter:true}},menuText:"Entity",text:"Entity",tooltip:"EntityDefinitionID",cellWrap:true,tpl:"{EDEntityName}"},{width:112,xtype:"templatecolumn",dataIndex:"EntityIDDefinitionID",editor:{xtype:"combobox",valueField:"value",store:{model:Ext.define(Ext.id(), {extend: "Ext.data.Model", fields:[{name:"text",type:"string"},{name:"value",type:"string"}] }),pageSize:50,proxy:{type:"ajax",extraParams:{"sql":"SELECT EntityIDDefinitionID, EntityIDName FROM Core.EntityIDDefinition","codeNameID":"0"},reader:{type:"json",rootProperty:"data"},url:"/GridPanelCommon/GetComboItems"},remoteFilter:true}},menuText:"Identifier",text:"Identifier",tooltip:"EntityIDDefinitionID",tpl:"{EIDEntityIDName}"},{width:114,dataIndex:"ValueInt",editor:{xtype:"textfield"},menuText:"ValueInt",text:"ValueInt",tooltip:"ValueInt"},{minWidth:200,flex:1,dataIndex:"ValueAlphaNumeric",editor:{xtype:"textfield"},menuText:"ValueAlphaNumeric",text:"ValueAlphaNumeric",tooltip:"ValueAlphaNumeric"},{hidden:true,width:100,dataIndex:"RecordStatus",editor:{xtype:"textfield"},menuText:"RecordStatus",text:"RecordStatus",tooltip:"RecordStatus"},{hidden:true,width:100,xtype:"numbercolumn",align:"right",dataIndex:"RowInsertUserID",editor:{xtype:"numberfield",decimalSeparator:"."},menuText:"RowInsertUserID",text:"RowInsertUserID",tooltip:"RowInsertUserID",format:"#"},{hidden:true,width:100,xtype:"datecolumn",align:"center",dataIndex:"RowInsertDateTime",editor:{xtype:"datefield",format:"m-d-y",submitFormat:"n/j/Y"},menuText:"RowInsertDateTime",text:"RowInsertDateTime",tooltip:"RowInsertDateTime",format:"m-d-y"},{hidden:true,width:100,xtype:"numbercolumn",align:"right",dataIndex:"RowUpdateUserID",editor:{xtype:"numberfield",decimalSeparator:"."},menuText:"RowUpdateUserID",text:"RowUpdateUserID",tooltip:"RowUpdateUserID",format:"MM-dd-yy"},{hidden:true,width:100,xtype:"datecolumn",align:"center",dataIndex:"RowUpdateDateTime",editor:{xtype:"datefield",format:"m-d-y",submitFormat:"n/j/Y"},menuText:"RowUpdateDateTime",text:"RowUpdateDateTime",tooltip:"RowUpdateDateTime",format:"m-d-y"},{hidden:true,width:100,xtype:"datecolumn",align:"center",dataIndex:"RowEffectiveDate",editor:{xtype:"datefield",format:"m-d-y",submitFormat:"n/j/Y"},menuText:"RowEffectiveDate",text:"RowEffectiveDate",tooltip:"RowEffectiveDate",format:"m-d-y"}]},features:[Ext.create("Ext.grid.feature.GroupingSummary",{ftype:"groupingsummary"})],listeners:{beforeclose:{fn:function(item){alert('closeing');}}},directEvents:{move:{fn:function(item,x,y){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/Move",extraParams:{"gpID":"73","x":x,"y":y,"userID":"17"},control:this,action:'Move'});}},resize:{fn:function(item,adjWidth,adjHeight){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/Resize",extraParams:{"gpID":"73","height":this.height,"width":this.width,"userID":"17"},control:this,action:'Resize'});}},filterchange:{fn:function(store,filters){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/FilterChange",control:this,action:'FilterChange'});}},columnhide:{fn:function(item,column){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/ColumnHide",extraParams:{"gpID":"73","cdi":column.dataIndex},control:this,action:'ColumnHide'});}},columnmove:{fn:function(item,column,fromIdx,toIdx){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/ColumnMove",extraParams:{"gpID":"73","cdi":column.dataIndex,"fromIdx":fromIdx,"toIdx":toIdx,"userID":"17"},control:this,action:'ColumnMove'});}},columnresize:{fn:function(item,column,width){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/ColumnResize",extraParams:{"gpID":"73","cdi":column.dataIndex,"cw":width},control:this,action:'ColumnResize'});}},columnshow:{fn:function(item,column){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/ColumnShow",extraParams:{"gpID":"73","cdi":column.dataIndex},control:this,action:'ColumnShow'});}},lockcolumn:{fn:function(item,column){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/LockColumn",control:this,action:'LockColumn'});}},sortchange:{fn:function(item,column,direction){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/SortChange",control:this,action:'SortChange'});}},unlockcolumn:{fn:function(item,column){Ext.net.directRequest({cleanRequest:true,url:"/GridPanelCommon/UnlockColumn",control:this,action:'UnlockColumn'});}}}},{store:{model:Ext.define(Ext.id(), {extend: "Ext.data.Model", fields:[{name:"Key"},{name:"Value"}] }),autoLoad:true,proxy:{data:[{"Key":"commandName","Value":"EntityProfilePopupTesting"},{"Key":"WindowDefinitionID","Value":"119"},{"Key":"EntityDefinitionID","Value":"21"}], type: 'memory'}},xtype:"grid",title:"Form Collection",columns:{items:[{width:150,dataIndex:"Key",text:"Key"},{width:350,dataIndex:"Value",text:"Value",cellWrap:true}]}}],activeTab:0}],layout:"fit",bodyPadding:2,bbar:{xtype:"toolbar",items:[{iconCls:"#CogGo",text:"Config",directEvents:{click:{fn:function(item,e){Ext.net.directRequest({cleanRequest:true,url:"/ExtEtc/WindowConfig",control:this});}}}}]},closeAction:"destroy",title:"...Testing..."}).show();"
Part of the javascript is the following: model:Ext.define("EPEntityIDModel", {extend: "Ext.data.Model", fields:[{name:"EntityIDIDN",type:"string"}
this works fine on the first popup, however if the user pops up the mentioned detail window for a second entity, the following error is generated:[E] Ext.data.schema.Schema.addEntity(): Duplicate entity name "EPEntityIDModel": EPEntityIDModel and EPEntityIDModel
Close method of window is destroy - but apparently the model is not being destroyed. Is there another method or listener to add to eliminate the model when the parent window is closed?Thanks
Last edited by Daniil; Feb 20, 2015 at 3:58 PM.
Reason: [FIXED] [#729] [3.1.0]