2012-01-16 81 views
0

基於GXT展示示例「Paging BeanModel Grid」,我嘗試在對數據源進行修改後重新加載網格。我定義的加載器是這樣的:重新加載GXT網格中的數據凍結

final BasePagingLoader<PagingLoadResult<ModelData>> loader = 
    new BasePagingLoader<PagingLoadResult<ModelData>>(proxy, new BeanModelReader()); 
loader.setRemoteSort(true); 

數據加載正確。

當我這樣做:

loader.load(); 

我的分頁工具欄只是凍結,去禁止,電網凍結過,顯示這似乎是一個裝載面具。

我嘗試添加一些事件迫使雙重載沒有運氣:

grid.addListener(Events.Attach, new Listener<GridEvent<ModelData>>() { 
    public void handleEvent(GridEvent<ModelData> be) { 
     loader.load(); 
    } 
}); 

我試圖用重新配置(商店釐米)選項以及與相同的結果。

任何幫助?

謝謝, Jordi。

+0

嘗試通過尋呼偏移和限制,像這樣'Loader.load方法(0,50)',和看看它是否有幫助。 – 2012-03-14 14:32:17

回答

1

加載欄灰顯,所以你可以看到它正在工作,並且網格也可能有加載消息。正在工作的代碼是服務器,可能正在準備項目。

在調用的開始和結束時,在您的服務器代碼(可能是RPC servlet)中設置日誌記錄消息,以查看它們運行的​​時間。根據你問題中的信息,這可能是實際發生的「凍結」。

在那段時間之後,瀏覽器中可能會出現暫停,但在這種情況下,加載循環將停止移動。

+0

服務器代碼工作正常。其實這兩種情況下的呼叫都是一樣的。我用螢火蟲檢查了RPC響應,並且它包含有效的數據。沒有服務器和JS異常。 – 2012-01-20 10:57:48

+0

然後您可能需要發佈更多代碼 - 某些連接與您的代碼基於的示例的連接方式不同,這些示例可正常工作。如果它不是服務器,並且服務器正在運行併發送良好數據,則它必須是客戶端。如果加載動畫仍在工作,那麼數據被某些東西忽略,如果它沒有旋轉,那麼客戶端被卡在某處的循環中,並且實際上被凍結。 – 2012-01-20 15:47:40

+0

我發佈了一些更多的代碼,任何提示? – 2012-01-24 17:35:56

0

對我來說有網格控制器上的錯誤:

代碼細節:

private final BasePagingLoader<PagingLoadResult<ModelData>> loader; 
private Grid<ModelData> grid; 
[...] 

public ListUsersView(RpcProxy<PagingLoadResult<UserTableEntryBean>> proxy) { 
     // Create loader 
     loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy, new BeanModelReader()); 
     loader.setRemoteSort(true); 

     // Create store 
     store = new ListStore<ModelData>(loader); 

     FlowLayout layout = new FlowLayout(); 
     layout.setMargins(new Margins(3, 0, 0, 0)); 
     this.setLayout(layout); 

     final PagingToolBar toolBar = new PagingToolBar(50); 
     toolBar.bind(loader); 

     List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); 
     columns.add(new ColumnConfig(UserTableEntryBean.Fields.username.name(), "Username", 100)); 
     columns.add(new ColumnConfig(UserTableEntryBean.Fields.email.name(), "E-mail", 200)); 
     ColumnConfig date = new ColumnConfig(UserTableEntryBean.Fields.creationDate.name(), "Creation date", 100); 
     date.setDateTimeFormat(DateTimeFormat.getFormat("dd/MM/y")); 
     columns.add(date); 

     ColumnModel cm = new ColumnModel(columns); 

     grid = new Grid<ModelData>(store, cm); 

     grid.setLoadMask(true); 
     grid.setBorders(true); 
     grid.setAutoExpandColumn(UserTableEntryBean.Fields.creationDate.name()); 

     [...] 
} 

public boolean refreshTable() { 
     return loader.load(); 
}