ext panel 它们的定义图像刷新

时间:2023-03-09 15:43:13
ext panel 它们的定义图像刷新

从管理发展的近期回报。事实上,它采取了一些努力,以适应,应对来自另一个角度的问题只。外观似良好的效果ext panel 它们的定义图像刷新。阿土,项目用到了EXT js。百度大神里面没找到一个合适的图片组件。自己写了个能够刷新的图片组件。先说明:因为项目原因,仅仅能贴出部分代码,此代码仅供參考

思路:先删除,再加入。使用doLayout()重布局

防止读取缓存中图片: 在图片链接后面加上" '?' + Math.random()",会从后台又一次读取

代码例如以下:

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 : "<img src='"

                                                            + picName

                                                            + "' width='80px' height='80px' style='padding:5px;'></img>"

                                                });

                                        imagePanel.add(imageInPanel);

                                        imagePanel.doLayout();



                                    }

});

刷新图片:imageBrowsePanel.refresh(picName);

picName中包含图片相通路,写推荐路径配置的背景,容易改变

版权声明:本文博主原创文章,博客,未经同意,不得转载。