
上一层是指什么呢,是不是这样
Extcreate("ExtpanelPanel",{title:'标题',
width: 200,
height: 200,
items:[{
xtype: 'button',text: '我是按钮',id:'button', handler: function() {
alert('You clicked the button!');
//在这里获取按钮所在的panel?获取方式如下
thisup('panel');
//this:就是指按钮对象,objup(str):是根据当前对象所在的容器,向外找匹配str的对象,str可以是id也可以是别名(xtype)
//另外,在这里获取下面的panel,即id=panel2的panel,可以这么写
var panel = ExtgetCmp('panel2');//最常见的
var panel2 = thisup('panel')down('panel');//在不知道panel2的id的情况下可以这么做
}
},{
xtype: 'panel',
title: '第二个panel'
id: 'panel2',
width: 100,
height: 100
}]
});
//
//代码是手打的,不确保能正确执行
是我理解的这样样吗
// 文件上传
var fp = new ExtformFormPanel({
region : 'south',
fileUpload : true,
collapsible : true,
frame : true,
title : '上传文件到服务器',
autoHeight : true,
bodyStyle : 'padding: 8px 10px 0 10px;',
labelWidth : 100,
labelAlign : 'right',
defaults : {
anchor : '95%',
msgTarget : 'side'
},
items : [{
allowBlank : true,
emptyText : '可重命名文件名',
xtype : 'textfield',
fieldLabel : '文件名称',
name : 'fileName'
}, {
allowBlank : false,
xtype : 'fileuploadfield',
emptyText : '请选择要上传的文件',
fieldLabel : '文件地址',
name : 'formFile',
buttonText : '浏览',
buttonCfg : {
iconCls : 'upload-icon'
}
}],
buttons : [{
text : '保存',
handler : function() {
if (fpgetForm()isValid()) {
fpgetForm()submit({
url : '/sparta/managefiledoop=upLoadFile',
waitMsg : '正在上传文件中',
success : function() {
Extexamplemsg('消息提示',
'文件上传成功!');
fileStorereload();
},
failure : function() {
Extexamplemsg('消息提示',
'文件上传失败!');
}
});
}
}
}, {
text : '重置',
handler : function() {
fpgetForm()reset();
}
}]
});
这是我写的可以重命名上传文件的上传工具栏,
你可以参考下,直接拷贝进去就可以用,
后台获取fileName和formFile这两个就可以了
html只接受字符串, 不接受ExtComponent或Element或原生DOM对象, 但可以是调用方法返回的字符串 也可以是function字面量调用, function(){}()这样
为item指定id属性, 使用原生方法修改DOM对象innerHTML, documentgetElementById(id), 任何位置都可调用 不过有浏览器兼容性问题
如果只是要生成div的化完全可以使用ExtPanel代替, 在任意位置都可以调用_windowadd/remove增减items, 之后需要调用_windowrender方法重新render
以上就是关于Extjs 获取上一层的对象全部的内容,包括:Extjs 获取上一层的对象、我用extjs做项目时用到了上传,属性 inputType : "file",结果在做修改时取不到路径,为空,怎么才能取到、ExtJs问题,如何动态添加Window控件items项中html的元素等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)