您好,我想在Extjs 4.1.1中将网格面板添加到我的视图中,但是在浏览器控制台“无法读取未定义的属性'substring'中得到此错误”。这是我的js代码:
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":"[email protected]", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"[email protected]", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"[email protected]", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"[email protected]", "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获取元素的正确方法是:http : Ext.get("my-div");
//www.objis.com/formationextjs/lib/extjs-4.0.0/docs/api/Ext.core.Element.html
因此,我相信您需要更改renderTo: Ext.Element.get('test')
为:renderTo: Ext.get('test')
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句