Oct 28, 2020, 1:46 PM
[OPEN] [#1835] Strange error on component destroy
Hello
If I take following js config
it has something with rebinding store to null when the grid is destroyed. As well if I remove drop groups the problem will go away.
Is there any reason why I'm getting this error?
Note that js code above is retrieved (in reality from far more complex) ascx as follows and calling ComponentLoader.ToConfig
If I take following js config
Ext.define('TestControl', {
alias: 'widget.EDMSAdmin_DynamicControls_User_TestControl',
height: 500,
hidden: true,
__renderTo: null,
width: 800,
"extend": "Ext.window.Window",
items: [{
border: true,
frame: true,
items: [{
xtype: "container",
flex: 1,
items: [{
flex: 1,
items: [{
store: {
model: Ext.ClassManager.isCreated(Ext.id()) ? Ext.id() : Ext.define(Ext.id(), {
extend: "Ext.data.Model",
fields: [{
name: "UserName"
}, {
name: "UserIdentifier"
}, {
name: "ObjectId"
}],
idProperty: "ObjectId"
}),
type: "paging",
autoLoad: true,
pageSize: 25,
sorters: [{
property: "UserName"
}],
proxy: {
type: 'pagingmemory'
}
},
"addPagingToolbar": false,
reference: "dgvAllGrid",
xtype: "grid",
flex: 1,
bbar: {
xtype: "pagingtoolbar",
displayInfo: true,
store: "idfbba790a61e63805"
},
columns: {
items: [{
flex: 1,
dataIndex: "UserName",
text: "Name"
}, {
flex: 1,
dataIndex: "UserIdentifier",
text: "User Identifier"
}, {
width: 70,
xtype: "commandcolumn",
commands: [{
xtype: "button",
command: "Select",
tooltip: {
text: "Select User"
},
iconCls: "#NoteEdit",
text: "Select"
}]
}]
},
selModel: {
selType: "checkboxmodel",
mode: "simple"
},
viewConfig: {
plugins: [{
ptype: "gridviewdragdrop",
ddGroup: "dgvSelectedGrid",
enableDrop: false
}],
xtype: "gridview"
}
}],
layout: {
type: "vbox",
align: "stretch"
},
title: "Available Users"
}, {
store: {
model: Ext.ClassManager.isCreated(Ext.id()) ? Ext.id() : Ext.define(Ext.id(), {
extend: "Ext.data.Model",
fields: [{
name: "UserName"
}, {
name: "UserIdentifier"
}, {
name: "ObjectId"
}],
idProperty: "ObjectId"
}),
type: "paging",
autoLoad: true,
sorters: [{
property: "UserName"
}],
proxy: {
type: 'pagingmemory'
}
},
reference: "dgvSelectedGrid",
xtype: "grid",
flex: 1,
bbar: {
xtype: "pagingtoolbar",
displayInfo: true,
store: "id9bd3e4a62fa8fbac"
},
title: "Selected Groups",
columns: {
items: [{
flex: 1,
dataIndex: "UserName",
text: "Name"
}, {
flex: 1,
dataIndex: "UserIdentifier",
text: "User Identifier"
}, {
width: 70,
xtype: "commandcolumn",
commands: [{
xtype: "button",
command: "Remove",
tooltip: {
text: "Remove User from selected list"
},
iconCls: "#Delete",
text: "Remove"
}]
}]
},
selModel: {
selType: "checkboxmodel",
mode: "simple"
}
}],
layout: {
type: "hbox",
align: "stretch"
}
}],
layout: {
type: "vbox",
align: "stretch"
}
}],
layout: "fit",
buttons: [{
reference: "btnSave",
iconCls: "#Disk",
text: "Save"
}, {
reference: "btnClose",
iconCls: "#Cancel",
text: "Close"
}],
closeAction: "destroy",
title: "User Search",
iconCls: "#Book",
hidden: true,
modal: true
});
and thenvar x= new TestControl();
x.show();
x.destroy()
I get Cannot read property 'apply' of nulit has something with rebinding store to null when the grid is destroyed. As well if I remove drop groups the problem will go away.
Is there any reason why I'm getting this error?
Note that js code above is retrieved (in reality from far more complex) ascx as follows and calling ComponentLoader.ToConfig
<ext:Window runat="server" Width="800" Height="500" Modal="True" Icon="Book" CloseAction="Destroy"
Hidden="true" Title="User Search" Frame="False" Layout="fit" >
<Items>
<ext:Panel Frame="true" runat="server" Border="true">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" />
</LayoutConfig>
<Items>
<ext:Container runat="server" Flex="1">
<LayoutConfig>
<ext:HBoxLayoutConfig Align="Stretch" />
</LayoutConfig>
<Items>
<ext:Panel runat="server" Title="Available Users" Flex="1" Frame="False">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" />
</LayoutConfig>
<Items>
<ext:GridPanel runat="server" Reference="dgvAllGrid" Flex="1" AddPagingToolbar="false">
<View>
<ext:GridView runat="server">
<Plugins>
<ext:GridDragDrop runat="server" EnableDrop="false" DDGroup="dgvSelectedGrid" />
</Plugins>
</ext:GridView>
</View>
<ColumnModel>
<Columns>
<ext:Column DataIndex="UserName" Text="Name" Flex="1" />
<ext:Column DataIndex="UserIdentifier" Text="User Identifier" Flex="1" />
<ext:CommandColumn Width="70">
<Commands>
<ext:GridCommand CommandName="Select" Text="Select" Icon="NoteEdit">
<ToolTip Text="Select User" />
</ext:GridCommand>
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel runat="server" Mode="Simple" />
</SelectionModel>
<Store>
<ext:Store runat="server" PageSize="25" AutoLoad="true" RemoteSort="false" RemotePaging="false">
<Sorters>
<ext:DataSorter Property="UserName"></ext:DataSorter>
</Sorters>
<Model>
<ext:Model runat="server" IDProperty="ObjectId">
<Fields>
<ext:ModelField Name="UserName" />
<ext:ModelField Name="UserIdentifier" />
<ext:ModelField Name="ObjectId" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<BottomBar>
<ext:PagingToolbar runat="server" HideRefresh="false" />
</BottomBar>
</ext:GridPanel>
</Items>
</ext:Panel>
<ext:GridPanel runat="server" Reference="dgvSelectedGrid" Flex="1" Title="Selected Groups">
<ColumnModel>
<Columns>
<ext:Column DataIndex="UserName" Text="Name" Flex="1" />
<ext:Column DataIndex="UserIdentifier" Text="User Identifier" Flex="1" />
<ext:CommandColumn Width="70">
<Commands>
<ext:GridCommand CommandName="Remove" Text="Remove" icon="Delete">
<ToolTip Text="Remove User from selected list" />
</ext:GridCommand>
</Commands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel runat="server" Mode="Simple" />
</SelectionModel>
<Store>
<ext:Store runat="server">
<Sorters>
<ext:DataSorter Property="UserName"></ext:DataSorter>
</Sorters>
<Model>
<ext:Model runat="server" IDProperty="ObjectId">
<Fields>
<ext:ModelField Name="UserName" />
<ext:ModelField Name="UserIdentifier" />
<ext:ModelField Name="ObjectId" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<BottomBar>
<ext:PagingToolbar runat="server" />
</BottomBar>
</ext:GridPanel>
</Items>
</ext:Container>
</Items>
</ext:Panel>
</Items>
<Buttons>
<ext:Button Reference="btnSave" runat="server" Text="Save" Icon="Disk" />
<ext:Button Reference="btnClose" runat="server" Text="Close" Icon="Cancel" />
</Buttons>
</ext:Window>