gwt-material
gwt-material copied to clipboard
Issue activating a MaterialSideNav using a MaterialNavBar using Errai 4.1.3 on GWT 2.8.2 and GMD 2.0.1
Hi there,
I have some trouble activating a MaterialSideNav instance using a MaterialNavBar.
The error I get in Chrome/FF is
Uncaught Error: com.google.gwt.user.client.ui.AttachDetachException: Exception caught: Could not setup MaterialSideNav please ensure you have MaterialNavBar with an activator setup to match this widgets id.
I followed the code samples in the gwt-material-demo-errai. They seem a bit outdated though. Here is my current code causing this behaviour:
Header.java
@Templated
public class Header extends Composite
{
@Inject
@DataField
MaterialNavBar navBar;
@PostConstruct
protected void init()
{
navBar.setActivates("sideNav");
navBar.setVisible(true);
navBar.getNavMenu().setActivates("sideNav");
navBar.getNavMenu().setVisibility(Style.Visibility.VISIBLE);
}
public void onSideNavOpened(@Observes SideNavOpenedEvent event)
{
navBar.getElement().getStyle().setProperty("transition", "none");
navBar.getElement().getStyle().setProperty("width", "calc(100% - 280px)");
}
public void onSideNavClosed(@Observes SideNavClosedEvent event)
{
navBar.getElement().getStyle().setProperty("transition", "none");
navBar.getElement().getStyle().setProperty("width", "100%");
}
}
Header.html
<header data-field="header" class="fixed">
<div data-field="navBar" class="z-depth-0" style="z-index: 998;"></div>
</header>
SideNav.java
@Templated
public class SideNav
{
@Inject
@DataField
MaterialSideNav sideNav;
@PostConstruct
protected void init()
{
sideNav.setId("sideNav");
sideNav.setWidth(280);
sideNav.reload();
}
}
SideNav.html
<div data-field="container">
<div id="sideNav" data-field="sideNav" ></div>
</div>
What might be causing the inability to link both? Am a missing something completely obvious?
Your help is greatly appreciated.
I don't know if it helps narrow it down, but the same issue is apparent using GWT 2.8.1.