我是智能GWT的新手。借助 listGrid唯一ID ,我将listGrid的状态存储在离线存储空间中。我使用包com.smartgwt.client.util.Offline
来存储listGrid的状态。现在将listGrid的状态存储在我的软件的version1
后,当我上传一个version2
的新版本时,一些listGrid状态没有改变。虽然我已经使用新编译的智能GWT模块上传了新版本2,但它使用的是版本1的状态。但是,当我清除浏览器缓存时,我能够获得ListGrid的新状态。我的问题是:
当我上传新版本时,有没有办法在不清除浏览器缓存的情况下获取ListGrid的新状态?
请查看下面的示例代码
public abstract class WebUIListGrid extends ListGrid {
protected GroupTypeInfo groupTypeInfo;
public final FieldNames fieldNames = FieldNames.getInstance();
public ResourceString resourceString = null;
// Constructor of the WebUIListGrid
public WebUIListGrid(GroupTypeInfo groupTypeInfo) {
resourceString = ResourceString.getInstance();
this.groupTypeInfo = groupTypeInfo;
this.groupId = groupTypeInfo.getGroupId();
setListGridProperties();
}
/**
* set basic properties
*/
private void setListGridProperties() {
// This Id is used for the offline storage
setID(getListGridId() + groupId);
addListGridField();
// Code to add the dataSorce
addDS();
// This will apply the state of the field using the offline storage
applyFieldState();
}
/**
* store list grid column fields in off line
*/
public void storeFieldState(){
// Here I am storing the state of the listGrid.
Offline.put(getListGridId(), getViewState());
}
/**
* apply list grid column state
*/
public void applyFieldState(){
try{
final String viewState = (String) Offline.get(getId());
if (viewState != null) {
addDrawHandler(new DrawHandler() {
@Override
public void onDraw(DrawEvent event) {
//restore any previously saved view state for this grid
setViewState(viewState);
}
});
}
} catch(Exception e) {
}
FieldStateChangedHandler fieldStateChangedHandler = new FieldStateChangedHandler() {
@Override
public void onFieldStateChanged(FieldStateChangedEvent event) {
Offline.put(getId(), getViewState());
updateFieldChangeCallBack();
}
};
addFieldStateChangedHandler(fieldStateChangedHandler);
}
/*
* The id of the offline storage
*/
private String getId(){
return LoginInfo.getLoginId()+"_"+getListGridId();
}
}
任何建议都将不胜感激。