【发布时间】:2016-05-13 19:44:55
【问题描述】:
我已经在网上搜索了答案,但没有找到任何答案。希望你能帮忙。
所以我对extJs 比较陌生。我在左侧有一个导航栏。当我按下第一个按钮时,会打开一个新窗口,其中包含一个表格并自动加载其数据。第一次它工作得很好,但是当我关闭窗口并再次打开它时,我收到错误“无法调用 null 方法 getRange”。
如果我打开第二个窗口(当我单击导航栏中的另一个按钮时),我有 4 个选项卡,每个选项卡都包含一个表格。每个选项卡都有一个带有按钮(创建、更改等)的工具栏。这里发生与第一个窗口相同的事情。 我也可以将这些表打印为列表,第一次工作正常,但是当我取消打印操作时,我再次收到错误。
我确保所有按钮和表格都有不同的引用,所以我真的不知道这可能是什么。
有什么想法吗?
我添加了我的面板,这将在此处打开新窗口:
items: [
{
xtype: 'tabpanel',
region: 'center',
items: [{
// 1. Tab
xtype: 'componentTap-panel',
title: UMA.Locale.rm.component.componentTitle,
id: 'componentTab'
}, {
// 2. Tab
title: UMA.Locale.rm.componentGroup.componentGroupTitle,
xtype: 'componentGroupTap-panel',
id: 'componentGroupTab'
}, {
// 3. Tab
title: UMA.Locale.rm.componentTemplateTitle,
xtype: 'componentTamplate-panel',
id: 'componentTemplateTab'
},
{
//4.Tab
title: UMA.Locale.rm.inventoryTitle,
xtype: 'inventoryTab-panel',
id: 'inventoryTab'
}
]
}
]
当窗口打开时,我添加我的表格和工具栏:
items: [{
xtype: 'toolbar',
region: 'north',
reference: 'componentToolbar',
items: [{
text: UMA.Locale.rm.buttonCreate,
action: 'createComp'
}, {
text: UMA.Locale.rm.buttonChange,
action: 'changeComp'
}, {
text: UMA.Locale.rm.buttonMove,
action: 'moveComp'
}, {
text: UMA.Locale.rm.buttonDelete,
action: 'deleteComp'
},{
text: UMA.Locale.rm.buttonPrint,
action: 'print',
margin: {
left: 8
}, {
xtype: 'componentTable-panel',
region: 'center'
}, {
xtype: 'componentsFilter-panel',
width: 300,
region: 'east'
}]
然后自动加载我的表格:
items:[{
xtype: 'filtergrid',
reference: 'componentGrid',
paging: true,
hideHeaders: false,
region: 'center',
selModel: new Ext.selection.RowModel({
mode: "MULTI"
}),
store: {
model: 'Component',
autoLoad: true
},
columns: [{ ...
【问题讨论】:
-
由于
getRange()是按钮处理程序中某处的存储方法(正如我从您的问题中理解的那样),您使用存储实例进行操作,其引用变量包含null。因此,请尝试将console.log存储在您的处理程序中。如果您提供一些代码(摆弄这个错误会很有帮助)我们可以提供更具体的解决方案。 -
@SergeyNovikov 添加了一些代码,希望你理解
-
像这样帮助你会非常困难,你至少可以创建一个重现这个问题的小提琴(fiddle.sencha.com)吗?
标签: javascript exception extjs null runtime-error