简体   繁体   English

在GWT中等待CellTable的数据

[英]Waiting for data for CellTable in GWT

I'm using GWT 2.4 with RequestFactory mechanism. 我正在将GWT 2.4与RequestFactory机制一起使用。 With bigger portions of data there is some extra time (1-2 sec) for celltables to get populated. 随着data量的增加,填充单元celltables需要一些额外的时间(1-2 sec) During that time celltable is empty and user doesn't know if anything will appear in it. 在此期间, celltable为空,用户不知道是否会出现任何内容。 Is there any way to enable waiting indicator for celltables for the time they are being populated? 有什么方法可以为celltables的时间启用等待indicator吗?

I've already configured waiting indicator for RequestFactory calls, so I've got prepared images for it, but I don't know how to do it. 我已经为RequestFactory调用配置了等待指示器,所以已经为它准备了images ,但是我不知道该怎么做。

Thanks. 谢谢。

You can use setLoadingIndicator API of CellTable - 您可以使用CellTable的setLoadingIndicator API-

cellTable.setLoadingIndicator( Your customised loading indicator widget );

Widget can be a image wrapped with in a panel or just an image. 小部件可以是面板中包裹的图像,也可以只是图像。

If you are using the ListDataProvider you need to code some more lines. 如果您使用的是ListDataProvider,则需要编写更多行。 When you do addDataDisplay method call it internally updates the row count to 0. With this Tables's state gets changed to Loaded. 当您执行addDataDisplay方法时,它会在内部将行计数更新为0。使用此方法,表的状态将更改为Loaded。 So we don't get the loading image. 因此,我们没有得到加载图像。

Workaround is, do addDataDisplay method call only just before the dataProvider.setList call. 解决方法是,仅在dataProvider.setList调用之前执行addDataDisplay方法调用。

Before you are calling the setLoadingIndicator you have to call the below method 在调用setLoadingIndicator之前,必须调用以下方法

cellTable.setVisibleRangeAndClearData(cellTable.getVisibleRange(),
   true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM