填充不适用于 extJS4 中的图像组件
我们知道ExtJS4是新的,即使它很小,我们也会遇到一些问题,但我们需要找到解决方案来完成升级。我们正在尝试对图像组件应用填充,但它不起作用。
ExtJS4 代码是:
Ext.onReady(function(){
Ext.QuickTips.init()
var image = {
xtype : 'image',
src : 'images.jpg',
height : 40,
width : 150,
border : true,
style : 'padding-left:60px',
resizable : false
};
var pan = Ext.create('Ext.panel.Panel',{
width : 400,
height : 400,
id : 'expan',
border : true,
title : 'Ex Panel',
items : [image],
renderTo : Ext.Body()
});
});
如果我们删除填充,则图像看起来像:
但如果我们应用填充,则图像大小正在减小,看起来像:
1.为什么会发生这种情况?
2.有什么办法可以将这个图像移动到面板的中心吗?
如果有人知道摆脱困境的方法,请帮助我。
As we know that ExtJS4 is new,we will get stuck with some problems even if it is small,but we need to get the solution to complete the upgradation.We are trying to apply padding to the image component but it is not working.
ExtJS4 code is:
Ext.onReady(function(){
Ext.QuickTips.init()
var image = {
xtype : 'image',
src : 'images.jpg',
height : 40,
width : 150,
border : true,
style : 'padding-left:60px',
resizable : false
};
var pan = Ext.create('Ext.panel.Panel',{
width : 400,
height : 400,
id : 'expan',
border : true,
title : 'Ex Panel',
items : [image],
renderTo : Ext.Body()
});
});
If we remove padding then the image looks like:
But If we apply padding then the image size is decreasing and it looks like:
1.Why this is happening?
2.Is there any way to move this image to center of the panel?
If anyone knows the path to get out from this.Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,首先我猜你正在使用一些用户扩展的组件图像,因为我似乎找不到该xtype,但问题是填充直接应用于该组件,因此该组件仍然具有 150 宽度,无论有没有填充,
我建议您将组件放入所需大小的面板中,然后将填充添加到该面板中。之后,将新创建的面板添加到所需的面板,它将创建更多组件,但会给您所需的外观,
这对我有用。
Ok for start i'm guessing you are using some user extended component image, because i cannot seem to find that xtype, But the issue is that the padding is applied directly to that component so the component will still have the 150 width with or without padding,
I suggest you put the component inside a panel the size you want and add the padding to that pannel. After that add the newly created panel to the desired panel, It will create more components but it will give you the desired look
This works for me.
据我所知,这在 ExtJS 4.1 中也不起作用。对我有用的一种解决方案是使用 padding 配置属性:
希望听到任何有更好解决方案的人的意见。
Near as I can tell, this isn't working in ExtJS 4.1 either. One solution that works for me is to use the padding config property:
Would love to hear from anyone with a better solution.