2
我不知道如何使用編輯器進行更改後如何更新我的celltable。如果我能得到編輯後的代理,那麼我可以使用數據提供者來更新我的單元格。我怎樣才能從RequestFactoryEditorDriver編輯代理
public void saveCampaign() {
driver.flush();
// the problem. proxy at this point should have the new values?....
context.persist().using(proxy).fire(new Receiver<Void>() {
@Override
public void onSuccess(Void response) {
showListView();
}
});
}
.using(proxy)中的代理不包含在編輯器上所做的更改。但是,服務器上的持久方法會獲取更新後的值。如果我從服務器重新加載數據,我會得到正確的值到celltable。
public void editCampaign(CampaignProxy proxy) {
this.proxy = proxy;
if (proxy != null) {
context = AEHOME.requestFactory.campaignRequest();
showEditView();
}
}
private void showEditView() {
driver.initialize(eventBus, AEHOME.requestFactory, editView);
driver.edit(proxy, context);
deckPanel.showWidget(deckPanel.getWidgetIndex(editView));
}
代理設置在列表視圖中:configurationPageView.proxy = selectionModel.getSelectedObject();
任何意見將不勝感激。謝謝。
謝謝你優秀的迴應。我現在有了更好的理解。我仍然無法獲得editProxy的更新來更新我的celltable。我試圖從持久方法返回新的代理,但是打破了ReqeustFactory接口。我期待celltable自動更新。在celltable顯示的代理中發生編輯後更新celltable的好方法是什麼? onSuccess(無效響應){ proxy.getAdTitle(); //代理此時具有舊值 showListView(); } – 2011-06-10 16:36:16
更新UI的最強大的方法是讓您的UI元素監聽共享的「EventBus」中的「EntityProxyChange」事件。當UI元素收到一個關於它所關心的實體已經更新的通知時,它應該創建自己的'RequestFactory.find()'(因爲事件只包含一個id)來檢索它需要的數據。這種解耦可以幫助減少代碼中關注點之間的交叉連接數量。在GWT 2.4中,使用'RequestBatcher.get()。find()'會使這個效率更高。 – BobV 2011-06-11 13:20:05