I have the following ui binder structure using mgwt 1.2-Snapshot.

<mgwt:LayoutPanel>  

    <g:FlowPanel />

    <mgwt:LayoutPanel>

        <b:MyTouchPanel>
            <g:Label ></g:Label>
            <g:Label></g:Label>
        </b:MyTouchPanel>

    </mgwt:LayoutPanel>

    <b:MyTouchPanel >

        <mgwt:LayoutPanel ui:field="contentPanel">

            <b:MyTouchPanel>
            </b:MyTouchPanel>

            <mgwt:ScrollPanel ui:Field="panel2">    
                <b:MyTouchPanel ></b:MyTouchPanel >
            </mgwt:ScrollPanel>

        </mgwt:LayoutPanel>

    </b:MyTouchPanel>


</mgwt:LayoutPanel>

The previous one is working fine. I refresh the red marked schrollPanel each time the content changes. My problem is that the following is not working:

<mgwt:LayoutPanel>  

    <g:FlowPanel />

    <mgwt:LayoutPanel>

        <b:MyTouchPanel>
            <g:Label ></g:Label>
            <g:Label></g:Label>
        </b:MyTouchPanel>

    </mgwt:LayoutPanel>

    <b:MyTouchPanel >

        <mgwt:LayoutPanel ui:field="contentPanel">

            <b:MyTouchPanel>
            </b:MyTouchPanel>

            <mgwt:LayoutPanel>  
                <b:MyTouchPanel ui:Field="panel1"></b:MyTouchPanel>
                <mgwt:ScrollPanel ui:Field="panel2">    
                    <b:MyTouchPanel ></b:MyTouchPanel >
                    </mgwt:ScrollPanel>
            </mgwt:LayoutPanel> 

        </mgwt:LayoutPanel>

    </b:MyTouchPanel>


</mgwt:LayoutPanel>

When I wrap the scrollPanel in a LayoutPanel it is not scrollable anymore. I have to do it this way because The red marked pieces are from a new page which are rendered in the overall layout. Since ui binder does not allow more than one root element I have to wrap panel1 and pane2 (the ScrollPanel) in another Panel for which I choose the LayoutPanel.

Is there a way to get the ScrollPanel (panel2) work correctly in my case?

有帮助吗?

解决方案

Have you tried to use a normal container like a FlowPanel, and put inside the boxes in an absolute position (have you played with css?? Maybe is the best solution for your problem).

Then, you have inside the FlowPanel your ScrollPanel and inside it you can introduce whatever you want.

If the panel1 contains a lot of info, you can do it using GQuery manually, in that way GWT won't know that the ScrollPanel has more than one child (but this is a tricky nasty solution :D).

Hope it helps.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top