Ext panel custom image refresh

Source: Internet
Author: User

Ext panel custom image refresh

Recently, it took some time to adapt from management back-to-development. However, to solve the problem from another point of view, it seems to be a good result. Not much nonsense. Recently, EXT js was used in the project, baidu did not find a suitable image component. I wrote an image component that can be refreshed. First, I explained that due to project reasons, only some code can be pasted. This code is for reference only.

Idea: First Delete, then add, and use doLayout () to relay


Prevent reading cached images: Add "'? '+ Math. random () ", will be re-read from the background


The Code is as follows:

ImagePanel = new Ext. Panel (

{
Region: 'center ',
Title :'',
Id: 'imagepanel ',
Name: 'imagepanel ',
Width: 105,
Height: 105,
Border: false,
BodyStyle :{
Padding: '10px'
},
Refresh: function (picName ){
PicName = picName + '? '+ Math. random ();
ImagePanel. removeAll ();
Var imageInPanel = new Ext. Panel (
{
Region: 'center ',
Title :'',
Id: 'imageinpanel ',
Name: 'imageinpanel ',
Border: false,
Width: 95,
Height: 95,
Html: "+ picName
+ "'Width = '80px 'height = '80px' style = 'padding: 5px; '> http://blog.csdn.net/xulei_19850322/article/details"
});
ImagePanel. add (imageInPanel );
ImagePanel. doLayout ();

}

});


Refresh image: imageBrowsePanel. refresh (picName );

The picName contains the relative path of the image. We recommend that you write the path in the background configuration to facilitate modification.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.