Click here to Skip to main content
15,923,389 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am creating a flickr search using ExtJs and flickr API. After retrieving the json response when I am rendering the images in the panel using the XTemplate, the div is getting added to the div before it. It becomed the child of the above div containing the image.

The code responsible for it goes something like this:

JavaScript
JSONPStore.on('load', function(){
 		
 	var record = JSONPStore.getAt(0);
 		
 	if(record){
 		data = record.raw.photos.photo;
 		//console.log(JSONPStore);
 		var newEl = Ext.create('Ext.panel.Panel', {
			width: 1240,
			margin: '0 20 0 20',
			id: 'pnlEl',
			store: JSONPStore,
			overflowY: 'auto',
			items: [
				{
					xtype: 'panel',
					id: 'toBeAdded',
					overflowY: 'auto',
					width: 600,
					layout: 'fit',
					style: "margin:15px",
		        		bodyStyle: "padding:5px;font-size:11px;",
		        		listeners:{
		        			render: function(){
		        				var tpl = new Ext.XTemplate(
						 				'<tpl for=".">',
							 				//'<div class="actualImg">',
						 						'<div>',
								 				'<span>{title}</span>',
								 				'<img src="http://farm{farm}.staticflickr.com/{server}/{id}_{secret}.jpg"',
								 				'</div>',
							 			'</tpl>'
						 			
						 	);
						 	//console.log(this);
						 	tpl.append(this.body, data);
						 		
		        		}
		        	}
				}
			]
		});
			
		if(vport.layout.align === 'stretch'){
			vport.add(newEl) ;
			vport.doComponentLayout();
		}
		
 	}
 	else{
 		console.log('Not Defined');
 	}
 }, this);
Posted
Updated 14-Mar-13 2:16am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900