Hi,
I need to open an entity without menu in a new browser window (or tab) using Jmix 2.0
Mario
Hi,
if I got your task correctly then the following will do the trick:
@ViewComponent
private DataGrid<User> usersDataGrid;
@Autowired
protected RouteSupport routeSupport;
@Subscribe("testBtn")
public void onTestBtnClick(final ClickEvent<JmixButton> event) {
User selectedItem = usersDataGrid.getSingleSelectedItem();
if (selectedItem == null) {
return;
}
String url = RouteConfiguration.forSessionScope().getUrl(UserDetailView.class,
routeSupport.createRouteParameters("id", selectedItem.getId()));
getUI().ifPresent(ui -> ui.getPage().open(url, "blank"));
}
Regards,
Gleb
Thanks for reply that is very good.
I would like to open in new view only the detail view class and not the main menu.
I would like to create a situation similar to dialogWindows.build() that opens a popup with only the detail view but using a new browser window.
Is it possible?
Thanks,
Mario
A view in opened inside a MainView because the @Route
annotations says that using the layout
attribute, e.g.: @Route(value = "users/:id", layout = MainView.class)
. If you define @Route
without layout
then a view will be opened on the entire screen. So, you can create a separate detail view that does’t define layout
attribute. In addition to that, you’ll need to override the OK and Close button in such view, because, by default, when a view is closed it tries to navigate either to the previous view or to the main view.