您如何获得Vaadin 23中的网格的列顺序?

发布于 01-24 02:13 字数 315 浏览 4 评论 0原文

我想保存用户在网格中返回同一页面时设置/更改的列顺序。

我读了这个问题 - 您如何获得列vaadin 14中的网格的命令?

vaadin 23中的这个问题是否固定? 如果有任何解决方案,请与我分享。

I would like to save the column order the user has set/changed when they come back to the same page in Grid.

I read this issue -
How do you get the column order for the Grid in Vaadin 14?

Is this issue fixed in Vaadin 23?
If there is any solution, please share with me.

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

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

发布评论

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

评论(1

ヤ经典坏疍2025-01-31 02:13:21

是的,
流量23是可能的。
在这里,我用来保存列顺序和宽度的听众

protected List<Grid.Column<T>> newColOrder= null;
grid.addColumnReorderListener((event) ->
{
    newColOrder= event.getColumns();
    persistColumns();
});
grid.addColumnResizeListener((event) ->
{
    persistColumns();
});

以及PersistColumn方法:

List<Grid.Column<T>> cols= newColOrder != null ? newColOrder : grid.getColumns();
for (Grid.Column<T> col : cols)
{
    boolean isHidden= !col.isVisible();
    String colWidth= col.getWidth();
    String colID= col.getKey();
    gcs.add(new GridColumnStatus(isHidden, colWidth, colID));
}

Yes,
this is possible with flow 23.
Here the listeners I use to save column order and width

protected List<Grid.Column<T>> newColOrder= null;
grid.addColumnReorderListener((event) ->
{
    newColOrder= event.getColumns();
    persistColumns();
});
grid.addColumnResizeListener((event) ->
{
    persistColumns();
});

And the persistColumn method:

List<Grid.Column<T>> cols= newColOrder != null ? newColOrder : grid.getColumns();
for (Grid.Column<T> col : cols)
{
    boolean isHidden= !col.isVisible();
    String colWidth= col.getWidth();
    String colID= col.getKey();
    gcs.add(new GridColumnStatus(isHidden, colWidth, colID));
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文