PDA

View Full Version : Updating Contents on a Tab



ninakajiji
12 Jan 2012, 6:22 PM
I have the following definition for a "Tab" on a tab panel.



{ title:'Daily TI(60)', border: false, xtype: 'panel', id: 'dailyid', padding: 10, flex: 1, html: '<img src="URL will change" height="350" width="695"/>', },


I would like the tab contents, which is a .jpg to be updated when i click on the tab to make it active. That, is the URL needs to be re-executed.

friend
13 Jan 2012, 5:44 AM
Consider using an Ext.Img for the graphic to be displayed. Take a look at the API docs and you'll see that you can call myImageComponent.setSrc('someURL') at any time to reload/refresh the image.

ninakajiji
13 Jan 2012, 11:35 AM
Thanks, I did read the API docs. But I am not sure how to modify the "Tab" information. That is, I am assuming one would drop the "html:" definition I currently have and replace it with Ext.Img. Would it be possible to suggest the exact syntax -- or point me to an example?

Thanks

friend
15 Jan 2012, 11:43 AM
An Ext.Img can be added directly to your tabpanel, where the Img component itself becomes the new tab. The Img component will then also accept a 'title' attribute, so you can set the tab's text.

As an alternative, I'd use a Panel with an items collection, in case I later wanted to add other components along with the image.