実行時に、ノードを削除したりノードを追加したときに、セルブラウザを正しく更新できる人がいました。リストを使用しているため、変更はすぐにCEllブラウザに反映されます私が変更を行っているときに、現場で更新されていません。GWT CEllブラウザリアルタイムアップデート
1
A
答えて
1
動的更新のためにListDataProvider setList(...)メソッドを使用できます。ここで私はRPCを介して細胞ブラウザをアップデートする方法の例です:
private void loadAllData(final ListDataProvider<Data> dataProvider) {
dBservice.getAllData(new AsyncCallback<List<Data>>() {
public void onSuccess(List<Data> result) {
dataProvider.setList(result);
}
public void onFailure(Throwable caught) {
caught.printStackTrace();
}
});
}
0
あなたがルートノード上のすべての子を閉じる必要がありcellBrowserを更新します。 とにかく何か
for (int i = 0; i < cellBrowser.getRootTreeNode().getChildCount(); i++) {
cellBrowser.getRootTreeNode().setChildOpen(i, false);
}
このようなAsyncDataProviderは、それが作品
private final class Model implements TreeViewModel{
private List<ZonaProxy> zonaList = null;
private List<CategoriaProxy> categoriaList = null;
public void setCategoriaList(List<CategoriaProxy> categoriaList) {
this.categoriaList = categoriaList;
}
public void setListZona(List<ZonaProxy> zonaList) {
this.zonaList = zonaList;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> NodeInfo<?> getNodeInfo(T value) {
CategoryDataProvider dataProvider1 = new CategoryDataProvider();
return new DefaultNodeInfo(dataProvider1, new CategoriaCell());
}
/**
* Check if the specified value represents a leaf node. Leaf nodes cannot be
* opened.
*/
public boolean isLeaf(Object value) {
if (value instanceof CategoriaProxy){
if (((CategoriaProxy) value).getLivello() == 3) {
return true;
}
}
return false;
}
}
private class CategoryDataProvider extends AsyncDataProvider<CategoriaProxy>
{
@Override
protected void onRangeChanged(HasData<CategoriaProxy> display)
{
requests.categoriaRequest().findAllCategorias(0, 8).with().fire(new Receiver<List<CategoriaProxy>>() {
@Override
public void onSuccess(List<CategoriaProxy> values) {
updateRowCount(values.size(), true);
updateRowData(0, values);
}
});
}
}
リフレッシュデータを呼び出します。
0
明らかに、データプロバイダを変更して更新するだけでは不十分です。
私の特定の例では、この例のように
public void updateCellBrowser(String id) {
TreeNode node = getNode(cellBrowser.getRootTreeNode(),id);
if(node != null && ! node.isDestroyed()) {
TreeNode parent = node.getParent();
int index = node.getIndex();
parent.setChildOpen(index, false,true);
parent.setChildOpen(index, true, true);
}
}
あなたは)セルIDが故にgetNode(次の 実装パス名です、それを閉じて再度開くために、影響を受けたセルを強制することも必要です。
private TreeNode getNode(TreeNode node, String id) {
for(int i=0; i < node.getChildCount(); i++)
if(node.isChildOpen(i)) {
Object value = node.getChildValue(i);
if(value instanceof String) {
String nodeId = ((String) value);
if(id.equals(nodeId))
return node.setChildOpen(i, true);
if(id.startsWith(nodeId))
getNode(node.setChildOpen(i, true),id);
}
}
return null;
}
関連する問題
- 1. GWT Cellウィジェットはなぜですか?
- 2. GWTのDatePicker-Cell-Popup用のCSS
- 3. GWTのクリック時にCellテーブルのヘッダ列名を取得
- 4. Excel = CELL( "color"、[Cell])関数
- 5. ボタンアクションin UITableView Cell
- 6. は、Cell Q1コラム
- 7. QTreeView-cellのQComboBox
- 8. PHPExcel clear cell comments
- 9. JavaFX listview cell growing
- 10. PrimeNG select datatable cell
- 11. Android TableLayout cell colspan
- 12. iOSテーブルビューRefresh Cell
- 13. Joinjs Cell vs Cellview
- 14. Jquery divide table cell
- 15. UISplitViewControllerとCell Deselection
- 16. VBA Integer from Cell
- 17. UITabelView cell reuseIdentifire
- 18. Octave Cell Array
- 19. Ag-greed cell multiline
- 20. find vbscript excel specific cell
- 21. Vaadin-Grid Multiline Cell Polymer
- 22. プロトタイプCellからpushViewController
- 23. GridView OnRowDataBound、CellのText.Length
- 24. Playビデオin UITableview Cell
- 25. Java Swing GridLayout "Cell span"?
- 26. CSS3ディスプレイ:table-cell&float?
- 27. ディスプレイ:table-cellとfloat
- 28. TTTableViewController with custom cell sample
- 29. Excel Vlookup with cell reference
- 30. CELLは、(「内容」)EXCEL