Custom Context Menu

From Documentation
Revision as of 08:18, 7 May 2015 by Hawk (talk | contribs) (Created page with "= Overview = This section describes how to pop up a new customized context menu in a Spreadsheet. The steps are simple # Disable built-in context menu # Create your own context m...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Overview

This section describes how to pop up a new customized context menu in a Spreadsheet. The steps are simple

  1. Disable built-in context menu
  2. Create your own context menu
  3. Show custom context menu

Disable built-in context menu

We should hide built-in context menu in order to show our customized one only.

Extracted from customContext.zul

		<spreadsheet id="ss" width="100%" height="100%" showFormulabar="true"
			showContextMenu="false" showToolbar="true" showSheetbar="true" maxVisibleRows="100"
			maxVisibleColumns="20" src="/WEB-INF/books/blank.xlsx" />
  • Line 2: Specify showContextMenu="false" to hide built-in context menu.


Create your own context menu

Menupopup is the most suitable component to build a context menu.

Extracted from customContext.zul

			<menupopup id="myContext">
				<menuitem id="display" label="Display Information" />
				<menuitem id="open" label="Open Dialog" />
			</menupopup>