我正在執行方法Datastore.delete(鍵)組成我的GWT Web應用程序,AsyncCallback調用了onSuccess()方法。我立即刷新http://localhost:8888/_ah/admin
,實體i意圖刪除仍然存在。同樣,我立即刷新我的GWT Web應用程序,我想刪除的項目仍然顯示在網頁上。請注意onSuccess()已被調用。如何知道Google AppEngine數據存儲區的操作已完成
那麼,我怎麼知道實體何時已經被刪除?
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;
}
,對不起,我的英語:-)
每次重新加載頁面時,都要查詢數據庫以獲取實際數據。 – kapand