Javascript Extjs:无法读取属性';子串';未定义的
您好,我想在Extjs 4.1.1中将网格面板添加到我的视图中,但我在浏览器控制台中遇到此错误“无法读取未定义的属性'substring'。这是我的js代码:Javascript Extjs:无法读取属性';子串';未定义的,javascript,extjs,Javascript,Extjs,您好,我想在Extjs 4.1.1中将网格面板添加到我的视图中,但我在浏览器控制台中遇到此错误“无法读取未定义的属性'substring'。这是我的js代码: Ext.require([ '*' ]); Ext.onReady(function(){ Ext.tip.QuickTipManager.init(); Ext.create('Ext.data.Store', {
Ext.require([
'*'
]);
Ext.onReady(function(){
Ext.tip.QuickTipManager.init();
Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.Element.get('test')
});
});
这是html代码:
<div id="test"> </div>
按ID获取元素的正确方法是:
Ext.get(“我的div”)代码>
因此,我认为您需要将renderTo:Ext.Element.get('test')
更改为:renderTo:Ext.get('test')
对不起,您可以粘贴控制台文本吗?如何查找未定义的内容?您正在对一个变量使用substring()
函数,该变量预期包含字符串,但不是字符串。堆栈跟踪(chrome默认在控制台中提供,只需单击灰色三角形…)将非常有用。这是一个错误快照:相同的代码适用于我