English 中文(简体)
GWT - 基本列表更改时单元格列表会更新
原标题:GWT - CellList wont update when underlying list changes

我有2个队列列表, 我想在不同的时间显示。 我有一个按钮, 当点击时应该将第一个列表替换为第二个列表 。

我尝试了两种方法,但很少成功。

第一个办法是创建一个 ListData Provider, 并将其与列表和表格绑在一起, 但当单击按钮, 列表结构没有改变时 。 /

我的第二个方法就是坚持正常的单元格列表,简单地重设行数和行数据。如果我按两次按钮,这个方法就起作用了。

我能忽略什么 任何帮助都会感激不尽

守则如下:

这是当我尝试在单元格列表中重新添加矩阵列表

public void refreshTable()
{
    systemTable.setRowCount(SYSTEMS.size(), true);
    systemTable.setRowData(0, SYSTEMS);
}

我用ListData Provider尝试过如下:

 private ListDataProvider<String> listDataProvider = new ListDataProvider<String>(SYSTEMS);

public void refreshTable()
{
    listDataProvider.refresh();
}
最佳回答

你可能正跑进这个 ""http://code.google.com/p/google-web-toolkit/issues/detail?id=7114" rel="nofollow"subject

Both versions should work. For the first solution try to reverse the calls (call first setRowData() and then setRowCount()):

public void refreshTable()
{
    systemTable.setRowData(0, SYSTEMS);
    systemTable.setRowCount(SYSTEMS.size(), true);
}

for the second solution I think you forgot to call addDataDisplay. Here are some ways to change the underlying data:

1. 创建一个新的 ListData Provider, 并设置 < code> Data Display (您不需要调用刷新) :

private ListDataProvider<String> listDataProvider = new ListDataProvider<String>(SYSTEMS);
listDataProvider.addDataDisplay(systemTable);

2. 制定一份新的清单,列出现有的ListDataProvider:

   listDataProvider.setList(SYSTEMS);

3. 修改现有清单:

   listDataProvider.getList().add/remove etc 
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签