我是 ExtJS 的新手,我尝试重用一些用 jQuery 生成的现有内容。有没有一种简单的方法可以将现有组件作为项目添加到容器中?
我的代码看起来像这样
var rect = $('<div>', {
'id' : 'rectangle'
}).text("this is a rectangle.");
var cont = new Ext.Container({
layout : 'absolute',
width : 400,
height : 300,
renderTo : Ext.getBody(),
border : 1,
style : {
borderColor : '#000000',
borderStyle : 'solid',
borderWidth : '1px'
},
items : [{
html : rect
}]
});
最佳答案
只需使用 .html()
获取该项目的 html
items : [{
html : rect.html()
}]
关于javascript - ExtJS 容器将现有内容设置为项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19232972/