ExtJS 视图创建
ExtJS View creation
我有以下看法:
Ext.define("FI.view.InstallBaseList", {
extend: 'Ext.grid.Panel',
require: 'FI.store.InstallBaseStore',
title: 'List',
alias: 'widget.installBaseList',
icon:'table.png',
store:'FI.store.InstallBaseStore',
columns: [],
divId:'',
dockedItems: [],
height: 200,
width: 700,
renderTo: "container",
enableLocking: true,
draggable: true,
resizable: true,
initComponent: function(config){
console.log("here");
}
});
这就是我尝试从控制器创建它的方式:
list = Ext.widget('installBaseList', params);
在浏览器中,我收到此错误:
me.dockedItems.insert is not a function
addDocked(items=[Object { xtype="header", title="List", titleAlign="left", more...}], pos=0) ext-all-debug.js (line 47051)
updateHeader(force=undefined) ext-all-debug.js (line 90398)
beforeRender() ext-all-debug.js (line 90275)
getRenderTree() ext-all-debug.js (line 26056)
render(container=Object { dom=div#container, id="container", $cache={...}, more...}, position=undefined) ext-all-debug.js (line 26193)
constructor(config=Object { divId="container", columns=[0]}) ext-all-debug.js (line 44380)
callParent(args=[Object { divId="container", columns=[0]}]) ext-all-debug.js (line 3728)
constructor(config=Object { divId="container", columns=[0]}) ext-all-debug.js (line 56387)
constructor () ext-all-debug.js (line 3892)
widget(name="installBaseList", config=Object { divId="container", columns=[0]}) ext-all-debug.js (line 5083)
(?)() ListCo...5323863 (line 98)
me.dockedItems.insert(pos + i, item); ext-all-debug.js (line 47051)
更重要的是,在initComponent
方法中,config
似乎是未定义的。为什么?
问题出在哪里?
initComponent 方法必须包含对 callParent 的调用,以确保父类的 initComponent 方法也被调用。
这是修复 http://jsfiddle.net/nscrob/EcX3Q/11/
此外,您不需要将参数配置发送到 initComponent,对象配置已经分配给组件,可以通过它访问。因此,如果您有:Ext.create('...',{mode:add});在 init 组件中,您将拥有 this.mode = add;
相关文章:
- 如何使用javascript从主svg对象动态创建svg视图框
- Kendo:我该如何在树视图中创建一个递归的hieiarchy
- 在创建视图mvc.net的过程中使用javascript
- 动态创建视图
- 在骨干中为相关模型创建视图和模板
- 在Rereduce函数中合并对象的属性会导致每次创建视图时产生错误的值
- 如何使用键为“@”的文档在 couchDB 中创建视图
- Microsoft动态在线 - 创建视图网址
- 在instanceof check中需要一个函数,但得到了body-正在尝试在Backbone中创建视图
- dojo自动使用iconcontainers创建视图
- 将创建视图嵌套在Backbone.js中的显示视图中
- 如何使用angular从json中创建视图(表单)
- 如何创建视图和获取数据mysql PHP javascript
- js:重新填充或重新创建视图
- JSF提交按钮-表单在一秒钟内被提交X次(直到重新创建视图)-如何防止它
- 动态地为类似的角度对象创建视图模型
- 如何在表内容中创建视图控制台
- 在AngularJS UI-Router中创建视图最干净的方法是什么?
- EXT调度器-无法创建视图预设
- Sencha Touch:创建视图时的功能调用