具有相同组件的 Vaadin 多条路线 [英] Vaadin Multiple Route With Same Component

查看:70
本文介绍了具有相同组件的 Vaadin 多条路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有两种模式的屏幕.创建 &看法.创建是一种表单样式,视图是一个表格(新流组件中的网格).由于这两个页面具有相同格式的视图页面,我创建了一个通用页面并在视图图标单击时动态分配路由.但问题是它总是呈现第一页.我怀疑,没有生成视图的新实例.

In my application I have tow screens with two modes. Create & View. Create is a form style one and view is a tabular(Grid in new flow component). Since the two pages have the view page in same format, I created a generic page and assigning routes dynamically on the view icon click. But issue is that it renders the first page always. I suspect, new instance of the view is not being generated.

视图图标

这是点击 CurrencyMenu View 图标时呈现的视图

This is the view rendered while clicking on CurrencyMenu View icon

这是单击 Country Menu View 图标时呈现的视图

This is the view rendered while clicking on Country Menu View icon

如您所见,视图是相同的.我在添加选项卡时动态分配路由.

As you can see the views are the same. I am dynamically assigning routes at time of adding the tab.

RouteConfiguration.forSessionScope().setRoute(routeURL + "/" + RouteNames.ROUTE_VIEW, ViewPageUI.class, MainView.class);

我想为多个路由呈现具有不同数据的同一页面.换句话说,查看页面的多个实例.(根据我的理解).

I wanted to render the same page with different data for multiple routes. In other words, multiple instances of view page.(As per my understanding).

提前致谢.

推荐答案

听起来您想要的是从一个公共超类扩展而来的两个视图.然后你可以在类上使用 @Route 定义路由,而不是在你真的不需要时添加动态路由(复杂性越低越好)

It sounds like what you want is two views that extend from a common super class. Then you can define the routes using @Route on the classes instead of adding dynamic routing when you do not really need it (less complexity is always better)

这篇关于具有相同组件的 Vaadin 多条路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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