Hello ExtJSers!
I've created a FormPanel and needed to embedd an IMG element in it (upload image preview).
So I did it like this:
var img_preview = document.createElement('img')
img_preview.width = 156
img_preview.width = 118
img_preview.src = 'http://www.tapuz.co.il/HP/images/wakingup.jpg'
var img_panel = new Ext.Panel({
items:[new Ext.Element(img_preview)]
})
and put 'img_panel' in Ext.FormPanel's [items].
It works in firefox but gives me the following error in explorer 7: [new version] DateTime Field - Page 29 - Ext JS Forums:: [new version] DateTime Field Ext 2.x: User Extensions and Plugins Iam getting error on IE7. Hi, Kindly see the attached datetimeerror.jpg. This is the code http://www.extjs.com/forum/showthread.php?p=222324HOME |
Line: 15658
Error: Unexpected call to method or property access.
on this line:
this[name] = Ext.get(pnode.appendChild(el));
from
createElement : function(name, pnode){
[name == 'bwrap']
from
Ext.Panel = Ext.extend(Ext.Container, {
So, is this the right way to embedd an image in a FormPanel? What am I missing?
Thanks,
michael
Thanks Condor,
this help me ;-)
thanks Condor!!
Use:
var img_panel = new Ext.Panel({
items:[{
xtype: 'box',
autoEl: {tag: 'img', height: 118, width: 156, src: 'http://www.tapuz.co.il/HP/images/wakingup.jpg'}
}]
})
You can't add an Element to an Ext.Container (e.g. Ext.Window). You can only add Ext.Components.
Use:
this._window = new Ext.Window({
layout:'fit',
width:400,
height:200,
closeAction:'hide',
plain: true
});
var img = new Ext.BoxComponent({
autoEl: {tag: 'img', src: Ext.BLANK_IMAGE_URL},
listeners: {
render: function(c) {
c.getEl().on('load', this.MyMethod, this);
},
scope: this
}
});
this._window.add(img);
....
img.getEl().dom.src = myvar;
Hi Condor,
I have similar problem, but I need to assign the image element to a variable so that I can change the image source later. My code now, is like the following:
this._window = new Ext.Window({
layout:'fit',
width:400,
height:200,
closeAction:'hide',
plain: true
});
var Img = new Ext.Element(document.createElement('img'));
this._window.add(Img);
Img.on('load',this.MyMethod,this);
....
Img.src = myvar;
But when I add the Img element I get same posted error (in IE7).
Some suggestion?
Challenging Books For A 14 Year Old?
First guitar : acoustic or electric?
|