前台JSP页面中有一句:
<div id="test" style="display:none" ></div>在Ext中有一个定时器,3秒钟调用一下getRunningInfo方法从后台取数据填充到JsonStore中去,JsonStore定义如下:
var store = new Ext.data.JsonStore({
id : 'aaa',
url : 'getImages',
fields : ['clientSmallPic', 'serverSmallPic', 'clientBigPic',
'serverBigPic']
});
从后台(HttpServlet)传回的数据为JSon格式,如下:
out.println("[{clientSmallPic: 'images/1.png',serverSmallPic: 'images/2.png',clientBigPic: 'images/3.png',serverBigPic: 'images/4.png'}]");然后以如下方式显示:
var tpl = new Ext.XTemplate(
'<table>',
'<tpl for=".">',
'<tr>',
'<td>',
'<div id="cs{clientSmallPic}" onclick="change(this.id)"><img src="{clientSmallPic}" title="{clientSmallPic}"></div>',
'</td>',
'<td>',
'<div id="ss{clientSmallPic}" onclick="change(this.id)"><img src="{serverSmallPic}" title="{serverSmallPic}"></div>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="2">',
'<div id="cb{clientSmallPic}" style="display: none" onclick="change(this.id)"><img src="{clientBigPic}" title="{clientBigPic}"></div>',
'<div id="sb{clientSmallPic}" style="display: none" onclick="change(this.id)"><img src="{serverBigPic}" title="{serverBigPic}"></div>',
'</td>', '</tr>', '</tpl>', '</table>'); var dv = new Ext.DataView({
id : "dv",
store : store,
tpl : tpl,
autoHeight : true,
itemSelector : 'div.thumb-wrap',
emptyText : '没有图片显示,请稍后重试'
});
var panel = new Ext.Panel({
id : 'images-view',
frame : false,
width : 788,
autoHeight : true,
collapsible : true,
layout : 'fit',
title : '图片',
header : false,
renderTo : "test",
items : [dv]
});
这样显示之后,前台图片刷新时老闪烁,这个怎么解决呢?
我想过双缓冲,自己试了好久没搞成功,怎么在B/S的js中做双缓冲呢?