Vaadin 编辑 json 响应

发布于 2024-10-27 18:35:53 字数 1438 浏览 6 评论 0原文

我使用 Vaadin 作为框架来代表我的应用程序的表示层。 我对 Vaadin Table 列表有疑问。我加载 1000 行和 5 列(是的,我需要加载全部 1000 行,还有一个加载更少的选项。=)),但是使用 Vaadin 时这不是很快。当我查看发送的 Json 时,我意识到有很多我不想为everu 表行发送的变量。

这是我现在的回应:

"domaindom-000000938.co_uk",
    ["17",
        {"id": "PID783","readonly":true,"locale": "en_EN","format": "yyyy-MM-dd","strict":true,"wn":false,"parsable":true,
            "v":{"day":7,"month":2,"year":2011}}],
    ["17",
        {"id": "PID784","readonly":true,"locale": "en_EN","format": "yyyy-MM-dd","strict":true,"wn":false,"parsable":true,
            "v":{"day":7,"month":2,"year":2011}}],
    ["17",
        {"id": "PID785","readonly":true,"locale": "en_EN","format": "yyyy-MM-dd","strict":true,"wn":false,"parsable":true,
            "v":{"day":7,"month":2,"year":2012}}],
    "","","ENG"],
    ["tr",{"key":206},"

我想将这个 Json 转换为更像

"domaindom-000000938.co_uk",
    ["17",
        {"id": "PID783","locale": "en_EN",,"strict":true,"wn":false,"v1":"2011-07-02", "v2":"2011-02-07", "v3":"2012-02-07"}],

您可以看到的,我删除了几个变量并将日期变量插入到相同的子句中。

所以我的问题是这样的。在 Vaadin 中,如何修改 Vaadin 创建 Json 响应的方式?我目前使用 BeanItemContainer 来保存我的对象,如下所示:

public BeanItemContainer getPagedDataSource(){
    List<Object> mylist = DAO.getDAO().createQuery(query, index, max);
    return new BeanItemContainer<Object>(type, mylist);
}

感谢您的任何帮助或反馈!

/马丁

Im using Vaadin as the framework to represent a presentation layer for my application.
I have a trouble with the Vaadin Table listing. I load 1000 rows with 5 columms (yes I need to load all 1000, there is also an option to load less. =)) but this is not very fast when using Vaadin. When I look at the Json sent I realize that there are lots of variables that i dont whant to be sent for everu table row.

This is the response i have as of now:

"domaindom-000000938.co_uk",
    ["17",
        {"id": "PID783","readonly":true,"locale": "en_EN","format": "yyyy-MM-dd","strict":true,"wn":false,"parsable":true,
            "v":{"day":7,"month":2,"year":2011}}],
    ["17",
        {"id": "PID784","readonly":true,"locale": "en_EN","format": "yyyy-MM-dd","strict":true,"wn":false,"parsable":true,
            "v":{"day":7,"month":2,"year":2011}}],
    ["17",
        {"id": "PID785","readonly":true,"locale": "en_EN","format": "yyyy-MM-dd","strict":true,"wn":false,"parsable":true,
            "v":{"day":7,"month":2,"year":2012}}],
    "","","ENG"],
    ["tr",{"key":206},"

I would like to transform this Json to be more like

"domaindom-000000938.co_uk",
    ["17",
        {"id": "PID783","locale": "en_EN",,"strict":true,"wn":false,"v1":"2011-07-02", "v2":"2011-02-07", "v3":"2012-02-07"}],

As you can see I have removed a couple of variables and inserted the date varialble in the same clauses.

So my quiestion is this. In Vaadin, how do I modify the way Vaadin creates the Json response? I currently use the BeanItemContainer to hold my objects like this:

public BeanItemContainer getPagedDataSource(){
    List<Object> mylist = DAO.getDAO().createQuery(query, index, max);
    return new BeanItemContainer<Object>(type, mylist);
}

Thanks for any help or feedback!

/Marthin

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

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

发布评论

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

评论(2

最偏执的依靠 2024-11-03 18:35:53

首先,该 JSON 是 Vaadin 内部通信的一部分,您不应修改它。但是,如果您想查看它,它是 JsonPaintTarget 以及创建 JSON 的相关组件(表)的 PaintContent 方法。

First, that JSON is part of Vaadin's internal communication and you should not modify it. However, if you wish to check it out, it is the JsonPaintTarget along with the paintContent-method of the component in question (the Table) that creates the JSON.

逐鹿 2024-11-03 18:35:53

如今,瓦丁以前所未有的方式运作。应用程序中的所有更改都必须发送给客户端。在客户端,每个组件都被单独处理,因此响应必须解决所有更改的组件。
表中的每一行都是一个单独的组成部分,因为答案很长。

我建议的解决方案:

  • 编写自己的表实现 - 强加
  • 限制 - 简单,但它是假体

Vaadin today operates in an unprecedented way. Everything will change in the application must be sent to the client. On the client side, each component is treated separately and therefore the response must address all components changed.
Each row in the table is a separate component because the answer is so long.

My proposed solution:

  • write your own implementation of the table - hard
  • the imposition of restrictions - easy, but it's prosthesis
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文