我正在使用 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 );
}