GWT Datagrid 不显示数据,但包含它 [英] GWT Datagrid does not show data , but contains it

查看:31
本文介绍了GWT Datagrid 不显示数据,但包含它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 cellTable 转换为 datagrid,因为我想稍后添加一个搜索处理程序,因此我需要固定的列标题.目前,我扩展了 celltable/datagrid 类并将小部件放入 simplelayoutpanel 并将其添加到我的 tabpanel>.

I'm trying to convert a cellTable into adatagrid, because I want to add a search handler later and therefor I need fixed column headers. At the moment I extend the celltable/datagrid class and put the widget into a simplelayoutpanel and add this to my tabpanel.

如果我使用 celltable,一切正常并且数据显示出来.如果我将类的类型更改为 datagrid,数据有时会显示出来(列名总是在那里).为了向表中添加内容,我使用了 setRowDatadataProvider.如果我设置断点来延迟表格内容的加载,表格有时会包含数据.如果我稍后为表格调用重绘方法,表格会显示正确的信息.但是表格应该自动加载内容.在我项目的其他位置"中,我也使用了数据网格,它在 Dialogboxes 中工作.

If I use the celltable, all works fine and the data shows up. If I change the type of the class to datagrid, the data shows sometimes up (The column names are always there). To add something to the table I used setRowData or a dataProvider. If I set breakpoints to delay the loading of the table content, the table does sometimes contain data. If I later call the redraw method for the table, the table shows the correct information. But the table should load automatically the content. At other "positions" of my project I used the datagrid also and it worked in Dialogboxes.

我认为项目的绘制肯定存在错误,因为如果我在表格上调用 .getRowCount 或已弃用的 .getDisplayedItems,它会返回给我应在表中的正确项目数.此外,如果我向表中添加选择模型并选择一个项目,则该项目包含有效数据.

I think there must be a bug with the drawing of the items, because if I call .getRowCount on the table or the deprecated .getDisplayedItems, it returns me the correct number of items which should be in the table. Also if I add a selection model to the table and select a item, the item contains valid data.

推荐答案

DataGrid 需要放在实现了 ProvidesResize 接口的 LayoutPanel 或 Panel 中才能可见.ScrollPanel 实现了该接口.

DataGrid requires to be put in a LayoutPanel or Panel that implements the ProvidesResize interface to be visible. ScrollPanel implements that interface.

此外,从 DataGrid 到根元素/面板的 LayoutPanel 链必须不间断.在您的面板层次结构中似乎就是这种情况.

Furthermore this chain of LayoutPanels from your DataGrid up to your root element/panel has to be unbroken. That seems to be the case in your panel hierarchy.

最后,您必须使用 RootLayoutPanel 而不是 RootPanel 来添加您的 LayoutPanel.那么您确定将 SimpleLayoutPanel 添加到 RootLayoutPanel 了吗?

Finally you have to use the RootLayoutPanel instead of the RootPanel to add your LayoutPanels. So did you make sure that you add your SimpleLayoutPanel to the RootLayoutPanel ?

也可以参考这个GWT:DataGrid - 设置高度 100% 未正确渲染

这篇关于GWT Datagrid 不显示数据,但包含它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆