GwtChosen在GWT LayoutPanel和RootLayoutPanel上表现不佳

时间:2013-04-24 19:23:33

标签: gwt gwtquery layoutpanels

我正在使用GwtChosen 1.1.0和GwtQuery 1.3.3。它似乎只适用于RootPanel小部件,而不是RootLayoutPanel小部件。

对于RootLayoutPanel不可用GwtChosen的已知限制吗?

示例代码和截图如下。注意RootLayoutPanel示例隐藏了堆栈中GWTChosen小部件的下拉列表,因此使其无法使用。

public void onModuleLoad() {
    if ( !ChosenListBox.isSupported() )
    {
        $( "#browserWarning" ).show();
    }

    ChosenListBox chosen = new ChosenListBox( true );
    // init default place holder text
    chosen.setPlaceholderText( "Choose your favourite chart..." );
    chosen.setWidth( "300px" );
    chosen.setMaxSelectedOptions( 4 );
    chosen.addChosenChangeHandler( new ChosenChangeHandler()
    {
        public void onChange( ChosenChangeEvent event )
        {
        }
    } );
    chosen.addGroup( "Simple" );
    chosen.addItemToGroup( "line" );
    chosen.addItemToGroup( "bar" );
    chosen.addItemToGroup( "pie" );
    chosen.addItemToGroup( "area" );

    //StackPanel stackpanel = new StackPanel();
    //stackpanel.add(chosen, "Choose");
    //stackpanel.add(wrapper, "Charts");
    //stackpanel.setHeight("150px");
    //RootPanel.get().add(stackpanel);

    StackLayoutPanel stackLayoutPanel = new StackLayoutPanel( Unit.EM );
    stackLayoutPanel.add( chosen, "Choose", 2 );
    stackLayoutPanel.setHeight( "150px" );
    RootLayoutPanel.get().add( stackLayoutPanel );
}

enter image description here enter image description here

1 个答案:

答案 0 :(得分:3)

从未使用GwtChosen,但它绝对看起来像know issue,虽然相对于DockLayoutPanel而不是RootLayoutPanel。还有一个附加的解决方法,可能有用。