我正在从我的 GWT Web 应用程序中执行方法 Datastore.delete(key),AsyncCallback 调用了 onSuccess() 方法。我http://localhost:8888/_ah/admin
立即刷新,我打算删除的实体仍然存在。类似于,我立即刷新我的 GWT Web 应用程序,我打算删除的项目仍然显示在网页上。注意 onSuccess() 已被调用。
那么,我怎么知道实体何时已被删除?
public void deleteALocation(int removedIndex,String symbol ){
if(Window.confirm("Sure ?")){
System.out.println("XXXXXX " +symbol);
loCalservice.deletoALocation(symbol, callback_delete_location);
}
}
public AsyncCallback<String> callback_delete_location = new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
public void onSuccess(String result) {
// TODO Auto-generated method stub
int removedIndex = ArryList_Location.indexOf(result);
ArryList_Location.remove(removedIndex);
LocationTable.removeRow(removedIndex + 1);
//Window.alert(result+"!!!");
}
};
服务器 :
public String deletoALocation(String name) {
// TODO Auto-generated method stub
Transaction tx = Datastore.beginTransaction();
Key key = Datastore.createKey(Location.class,name);
Datastore.delete(tx,key);
tx.commit();
return name;
}
对不起,我英语不好:-)