manolo / gwt-polymer-elements

Polymer Web Components for GWT. A collection of Material Design widgets for desktop and mobile.
Apache License 2.0
155 stars 49 forks source link

error when using submenu in widget mode #77

Closed koolben closed 7 years ago

koolben commented 8 years ago

Hello i'm new to gwt and polymer and i try to implement a drop down menu and I get a "Uncaught java.lang.RuntimeException: Cannot find element with id "gwt-uid-4". Perhaps it is not attached to the document body." at runtime. I certainly made a mistake but i didn't manage to find what is my error. Please help me : here is my ui.xml file :

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
    xmlns:g='urn:import:com.google.gwt.user.client.ui'
    xmlns:s='urn:import:com.benv.client'
    xmlns:p='urn:import:com.vaadin.polymer.paper.widget'
    xmlns:i='urn:import:com.vaadin.polymer.iron.widget'>
    <g:HTMLPanel>
        <style is="custom-style">
            paper-icon-item {
            position: relative;
            overflow: hidden;
            }
            .toolbar {
            background: #4285f4 !important;
            }
            .header {
            font-size: 200%;
            margin-left: 50px;
            }
            .content {
            padding: 15px;
            }
            .add {
            position: absolute;
            bottom: 20px;
            right: 20px;
            --paper-fab-background:
            var(--paper-red-500);
            }
        </style>
        <p:PaperDrawerPanel>
            <div drawer="">
                <p:PaperHeaderPanel>
                    <p:PaperToolbar>
                        <div>Application</div>
                    </p:PaperToolbar>
                    <p:PaperMenu>
                        <p:PaperSubmenu>
                            <div menu-trigger=""><p:PaperItem attributes="menu-trigger">Avant match</p:PaperItem></div> 
                            <div menu-content="" sublist="">
                            <p:PaperMenu attributes="sublist">
                                <p:PaperItem>Entrainements</p:PaperItem>
                                <p:PaperItem>Convocations</p:PaperItem>
                                <p:PaperItem>Feuille de Match</p:PaperItem>
                            </p:PaperMenu>
                            </div>
                        </p:PaperSubmenu>
                        <p:PaperSubmenu>
<!--                            <div menu-trigger=""><p:PaperItem attributes="menu-trigger">Match</p:PaperItem></div> -->
<!--                            <div menu-content="" sublist=""> -->
<!--                            <p:PaperMenu attributes="sublist"> -->
<!--                                <p:PaperItem>Statistiques</p:PaperItem> -->
<!--                                <p:PaperItem>Systemes de jeux</p:PaperItem> -->
<!--                            </p:PaperMenu> -->
<!--                            </div> -->
                        </p:PaperSubmenu>
                        <p:PaperSubmenu>
<!--                            <div menu-trigger=""><p:PaperItem attributes="menu-trigger">On refait le match</p:PaperItem></div> -->
<!--                            <div menu-content="" sublist=""> -->
<!--                            <p:PaperMenu attributes="sublist"> -->
<!--                                <p:PaperItem>Sondages</p:PaperItem> -->
<!--                                <p:PaperItem>Forum</p:PaperItem> -->
<!--                            </p:PaperMenu> -->
<!--                            </div> -->
                        </p:PaperSubmenu>
                    </p:PaperMenu>
                </p:PaperHeaderPanel>
            </div>
            <div main="">
                <p:PaperHeaderPanel>
                    <p:PaperToolbar>
                        <p:PaperIconButton attributes="paper-drawer-toggle" icon="menu">
                        </p:PaperIconButton>
                        <div>Title</div>
                    </p:PaperToolbar>
                    <div> <s:UserForm></s:UserForm></div>
                </p:PaperHeaderPanel>
            </div>
        </p:PaperDrawerPanel>
    </g:HTMLPanel>
</ui:UiBinder>
manolo commented 7 years ago

Seems like your declarative template has some issues. I tried the first part at didn't work to me. This fragment does work though:

    <p:PaperMenu>
        <p:PaperSubmenu>
            <p:PaperItem class="menu-trigger">Avant match</p:PaperItem>
            <div class="menu-content sublist">
                <p:PaperMenu>
                    <p:PaperItem>Entrainements</p:PaperItem>
                    <p:PaperItem>Convocations</p:PaperItem>
                    <p:PaperItem>Feuille de Match</p:PaperItem>
                </p:PaperMenu>
            </div>
        </p:PaperSubmenu>
    </p:PaperMenu>