MediaWiki:Sidebar

Z Wiki BR
Przejdź do nawigacji Przejdź do wyszukiwania

// Example: Create a DropdownWidget and use the getMenu() method to get the // contained menu and modify it. var dropDown = new OO.ui.DropdownWidget( { label: 'Dropdown menu: Select one option', menu: { items: [ new OO.ui.MenuOptionWidget( { data: 'a', label: 'First' } ), new OO.ui.MenuOptionWidget( { data: 'b', label: 'Second' } ), new OO.ui.MenuOptionWidget( { data: 'c', label: 'Third' } ) ] } } );

$( document.body ).append( dropDown.$element );

// Get the menu from the dropdown using the getMenu() method. // In this example, the getItemFromData() method returns a reference to the option // that contains the specified data (i.e., 'a', which is the first menu option). // This option is then disabled with the setDisabled() method. dropDown.getMenu().getItemFromData( 'a' ).setDisabled( true );