Ext4.0.7使用Ext.grid.ColumnModel报错:TypeError: Ext.grid.Model is not a constructor
2013-12-30 22:55
666 查看
代码如下:
google了一下:In Extjs 4.0 ,there is no colModel config for GridPanel(http://www.sencha.com/forum/showthread.php?199720-Ext.grid.ColumnModel-is-not-a-constructor)然后查看其API:其用法如下
运行效果:
Ext.onReady(function(){ //定义列 var cm = new Ext.grid.ColumnModel([ {header: '编号', dataIndex: 'id'}, {header: '名称', dataIndex: 'name'}, {header: '描述', dataIndex: 'des'} ]); //数据定义 var data = [ ['1001','name1','description1'], ['1002','name1','description1'], ['1003','name1','description1'], ['1004','name1','description1'], ['1005','name1','description1'] ]; //数据源定义 var store = new Ext.data.Store({ proxy: new Ext.data.MemoryProxy(data), reader: new Ext.data.ArrayReader({},[ {name: 'id'}, {name: 'name'}, {name: 'des'} ]) }); store.load(); //grid panel var grid = new Ext.grid.GridPanel({ renderTo: Ext.getBody(), store: store, cm: cm }); });
google了一下:In Extjs 4.0 ,there is no colModel config for GridPanel(http://www.sencha.com/forum/showthread.php?199720-Ext.grid.ColumnModel-is-not-a-constructor)然后查看其API:其用法如下
Ext.onReady(function(){ Ext.create('Ext.data.Store', { storeId: 'simpleStore', fields: ['name', 'email', 'phone'], data:{ 'items':[ {'name':'yanshiying', 'email':'email', 'phone':'1234567890'}, {'name':'yanshiying', 'email':'email', 'phone':'1234567890'}, {'name':'yanshiying', 'email':'email', 'phone':'1234567890'} ] }, proxy: { type: 'memory', reader: { type: 'json', root: 'items' } } }); Ext.create('Ext.grid.Panel', { title: 'Simple', store: Ext.data.StoreManager.lookup('simpleStore'), columns: [ {header: 'Name', dataIndex: 'name'}, {header: 'Email', dataIndex: 'email'}, {header: 'Phone', dataIndex: 'phone'} ], height: 200, width: 400, renderTo: Ext.getBody() }); })
运行效果:
相关文章推荐
- 关于ExtJs使用时报错:TypeError: b[e] is not a constructor
- 错误中学习--TypeError: Ext.panel is not a constructor
- Uncaught TypeError: *** is not a constructor
- Flask 中使用 JSON 响应页面的 Ajax 请求报错 TypeError: 'dict' object is not callable
- vue项目使用手机浏览器访问时报错:Uncaught TypeError: Object.assign is not a function
- 在使用Fragstats4.1软件,添加ESRI Grid图层时出现错误:Error: Grid IO dll is not loaded。
- python3中,socket使用send函数时出现的错误:TypeError: a bytes-like object is required, not 'str'
- 关于jquery使用live()方法的问题Uncaught TypeError: $(...).live is not a function
- Scrapy使用shell命令报错scrape shell TypeError: 'float' object is not iterable
- jQuery中live()使用报错,TypeError: $(...).live is not a function
- easyui使用combobox报错Uncaught TypeError: row[opts.textField].toLowerCase is not a function
- TypeError: Ext.fly(...).findParent is not a function
- jQuery中live()使用报错,TypeError: $(...).live is not a function(转)
- Extjs 很恶心的错误,无法找原因,只有:TypeError: A[(intermediate value)] is not a constructor
- Extjs TypeError: types[(intermediate value)] is not a constructor
- TypeError: url.indexOf is not a function ,使用jquery load()出现错误
- kendoUI grid 过滤时出错:TypeError toLowerCase is not a function
- vue踩坑--TypeError: __WEBPACK_IMPORTED_MODULE_1_vuex__.a.store is not a constructor
- 微软必应地图加载错误:Uncaught TypeError: Microsoft.Maps.Location is not a constructor
- 使用vue时Module build failed: TypeError: this._init is not a function错误的解决方法