Gwt GXT-网格不';不能反映变化

Gwt GXT-网格不';不能反映变化,gwt,gxt,Gwt,Gxt,请你看一下下面的代码,看看有什么问题。问题是加载数据时,网格中不会出现任何数据。所有类别如下(我只发布应用程序中与失败功能相关的部分): ItemGrid(该类表示通过feedService.loadItems(asyncCallback)检索的数据的网格) Item.class(表示实体的类) 我希望这部分代码足够了。我知道这可能是一个简单的问题,但我是GWT/GXT的新手,并被困在这个问题中。我会仔细考虑任何反馈。我发现了问题(坦率地说,我不明白为什么会有问题)。问题在项目实体中。我实现了B

请你看一下下面的代码,看看有什么问题。问题是加载数据时,网格中不会出现任何数据。所有类别如下(我只发布应用程序中与失败功能相关的部分):

ItemGrid(该类表示通过feedService.loadItems(asyncCallback)检索的数据的网格)

Item.class(表示实体的类)


我希望这部分代码足够了。我知道这可能是一个简单的问题,但我是GWT/GXT的新手,并被困在这个问题中。我会仔细考虑任何反馈。

我发现了问题(坦率地说,我不明白为什么会有问题)。问题在项目实体中。我实现了BeanModelTag(而不是扩展BaseModel),将BeanModelReader作为参数传递到
BaseListLoader(代理,读取器)
,然后它就工作了。但我仍然不明白为什么扩展BaseModel会导致数据传输失败。

使用GXT 2.x而不是3.x有什么原因吗?您在浏览器中检查过DOM吗?这可能有助于指出问题所在。要么数据从未到达客户机,要么可能是布局问题。@Darek Kay使用GXT 2.X的原因是我不久前参与的商业项目中使用了GXT 2.X。谢谢你的及时回复。我找到了前面描述的解决方案。
public class ItemGrid extends LayoutContainer {

    public ItemGrid() {
        setLayout(new FitLayout());
    }

    @Override
    protected void onRender(Element parent, int index) {
        super.onRender(parent, index);
        final List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
        columns.add(new ColumnConfig("title", "Title", 200));
        columns.add(new ColumnConfig("description", "Description", 200));

        final ColumnModel columnModel = new ColumnModel(columns);
        final FeedServiceAsync feedService = Registry.get(RSSReaderConstant.FEED_SERVICE);
        RpcProxy<List<Item>> proxy = new RpcProxy<List<Item>>(){
            @Override
            protected void load(Object o, AsyncCallback<List<Item>> asyncCallback) {
                feedService.loadItems(asyncCallback);
            }
        };
        ListLoader<ListLoadResult<Item>> loader = new BaseListLoader<ListLoadResult<Item>>(proxy);
        ListStore<ModelData> itemStore = new ListStore<ModelData>(loader);

        List<ModelData> modelDataList = itemStore.getModels();
        for (ModelData model : modelDataList) {
            System.out.println("I got that point");
            Map<String, Object> modelMap = model.getProperties();
            Set<String> keys = modelMap.keySet();
            for (String key : keys) {
                System.out.println("Key is " + key);
            }
        }

        Grid<ModelData> grid = new Grid<ModelData>(itemStore, columnModel);
        grid.setBorders(true);
        grid.setAutoExpandColumn("description");
        loader.load();
        add(grid);
    }
}
public class RssMainPanel extends ContentPanel {

    public RssMainPanel(String label) {
        setHeadingText(label);
        setLayout(new FitLayout());
        add(new ItemGrid());
    }
}
public class Item extends BaseModel implements IsSerializable {

    private String cathegory;
    private String description;
    private String link;
    private String title;

    public String getCathegory() {
        return cathegory;
    }

    public void setCathegory(String cathegory) {
        this.cathegory = cathegory;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
}