Menuitem"
From Documentation
Tmillsclare (talk | contribs) |
Jumperchen (talk | contribs) m |
||
Line 3: | Line 3: | ||
= Menuitem = | = Menuitem = | ||
− | *Demonstration: | + | *Demonstration: [http://www.zkoss.org/zkdemo/userguide/#t1 Menu] and [http://docs.zkoss.org/wiki/ZK_5:_New_File_Upload#Live_Demo Fileupload] |
*Java API: <javadoc>org.zkoss.zul.Menuitem</javadoc> | *Java API: <javadoc>org.zkoss.zul.Menuitem</javadoc> | ||
*JavaScript API: <javadoc directory="jsdoc">zul.menu.Menuitem</javadoc> | *JavaScript API: <javadoc directory="jsdoc">zul.menu.Menuitem</javadoc> | ||
Line 10: | Line 10: | ||
A single choice in a <tt>Menupopup</tt> element. It acts much like a button but it is rendered on a menu. | A single choice in a <tt>Menupopup</tt> element. It acts much like a button but it is rendered on a menu. | ||
− | Default <tt>getZclass(): z-menu-item </tt>. | + | Default <tt>getZclass(): z-menu-item </tt>. |
+ | |||
+ | Within ZK 5, the file upload has been redesigned so it can be integrated with any widget. For example, The toolbarbutton can now be used to upload a file. In addition to this, the display of the upload status has been enhanced and can be customized easily. | ||
= Example = | = Example = | ||
Line 27: | Line 29: | ||
</menu> | </menu> | ||
</source> | </source> | ||
+ | |||
+ | = Fileupload Example = | ||
+ | <source lang="xml"> | ||
+ | <menuitem upload="true" label="Customized Attach" onUpload='alert("File is uploaded!")'/> | ||
+ | </source> | ||
+ | |||
=Supported events= | =Supported events= | ||
Line 39: | Line 47: | ||
'''Description:''' A menu command is associated with a menu item. There are two ways to associate a command to it: the onClick event and the href property. If a event listener is added for a menu item for the onClick event, the listener is invoked when the item is clicked. | '''Description:''' A menu command is associated with a menu item. There are two ways to associate a command to it: the onClick event and the href property. If a event listener is added for a menu item for the onClick event, the listener is invoked when the item is clicked. | ||
+ | |- | ||
+ | | <center>onUpload</center> | ||
+ | | <javadoc>org.zkoss.zk.ui.event.UploadEvent</javadoc> | ||
+ | |||
+ | '''Description: ''' | ||
+ | |||
+ | Denotes user has uploaded a file to the component. | ||
|} | |} |
Revision as of 03:57, 18 May 2010
Menuitem
- Demonstration: Menu and Fileupload
- Java API: Menuitem
- JavaScript API: Menuitem
Employment/Purpose
A single choice in a Menupopup element. It acts much like a button but it is rendered on a menu. Default getZclass(): z-menu-item .
Within ZK 5, the file upload has been redesigned so it can be integrated with any widget. For example, The toolbarbutton can now be used to upload a file. In addition to this, the display of the upload status has been enhanced and can be customized easily.
Example
<menu label="File">
<menupopup>
<menuitem label="New" onClick="alert(self.label)"/>
<menuitem label="Open" onClick="alert(self.label)"/>
<menuitem label="Save" onClick="alert(self.label)"/>
<menuseparator/>
<menuitem label="Exit" onClick="alert(self.label)"/>
</menupopup>
</menu>
Fileupload Example
<menuitem upload="true" label="Customized Attach" onUpload='alert("File is uploaded!")'/>
Supported events
MouseEvent
Description: A menu command is associated with a menu item. There are two ways to associate a command to it: the onClick event and the href property. If a event listener is added for a menu item for the onClick event, the listener is invoked when the item is clicked. | |
UploadEvent
Description: Denotes user has uploaded a file to the component. |
Supported Children
*NONE
Use cases
Version | Description | Example Location |
---|---|---|
Version History
Version | Date | Content |
---|---|---|
5.0.2 | 05/11/2010 | Initialization |