将 Google App Engine 与 GWT Celltable 集成以处理大型数据集

发布于 2024-11-15 01:46:07 字数 623 浏览 6 评论 0原文

我目前正在尝试为构建在数据存储上的 Web 应用程序实现一个 gwt 前端。我想要像我的 AsyncServices (gin) 这样的东西从服务器获取数据并将该数据显示在 Celltable 中。由于我的数据集可能非常大,我希望每次用户点击页面前进/按钮时都获取该数据。

<代码> 私有 CellTable 表 = new CellTable(); ScheduleTable = new CellTable();

SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true); pager.setDisplay(表);

提供者 = 新的 AsyncDataProvider() { @覆盖 protected void onRangeChanged(HasData 显示) { //TODO:在此处获取并显示来自 GAE 的适当数据! } };

provider.addDataDisplay(表);

I am currently trying to implement a gwt front end for my web application that is built on datastore. I would like to have something like my AsyncServices (gin) get the data from the server and display that data in a Celltable. Since my datasets can be very large I would like that data to be fetched every time the user hits the page forward/button.


private CellTable table = new CellTable();
scheduleTable = new CellTable();

SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
pager.setDisplay(table);

provider = new AsyncDataProvider() {
@Override
protected void onRangeChanged(HasData display) {
//TODO: Get and Show the appropriate data from GAE here!
}
};

provider.addDataDisplay(table);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与君绝 2024-11-22 01:46:07

是的,这是可能的。这就是我的做法。

实现一个抽象寻呼机。我必须创建一个复合小部件并在构造函数中初始化该小部件。

我用了两个按钮&用于分页上一页和下一页并分别显示页面的标签。在下一个按钮的 clickHandler 中,我调用 RPC 并获取我想要显示的数据列表。然后将该列表附加到单元格表的数据提供者的现有列表中。然后调用数据提供者的flush方法。这会将更改推送到单元格表的显示上。如果您的单元格表仍然没有反映数据(它应该反映数据),只需再次刷新数据提供程序或使用 setPageStart & setPageSize 为表格设置新范围。

您必须覆盖onRangeOrRowCountChanged,这是您显示当前所在页面并执行寻呼机可能需要执行的任何操作的位置。

对于上一个按钮,只需调用 this.previous() 因为抽象分页器提供了您需要的所有功能。我们没有使用 this.next(),而是使用我们自己的函数来填充表。并移至下一页。

Yes it is possible. And here it is how I did it.

Implement an Abstract Pager. I had to create a Composite Widget and intialize the Widget in the constructor.

I had used two buttons & a label for paging previous and next and showing the page respectively. And in the clickHandler of the next button, I call a RPC and get the list of data I want to show. Then append the list to the existing list of the dataprovider of the celltable. Then call flush method of the data provider. This will push the changes onto the display that is the cell table. Incase your cell table still does not reflect the data, which it should,just flush the dataprovider again or use the setPageStart & setPageSize for the table and set the newrange.

You have to override the onRangeOrRowCountChanged this is where you display which page you are in and do whatever yo might need your pager to do.

For the previous button just call this.previous() as Abstract pager provides all the functionalities you need. Instead of using this.next() we are using our own function to populate the table. and move to the next page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文