Menu

Menu is special widget that is used for Buttons in bars and for context menu.
Elements for menu are items that have the following types: 'string', 'number', '-', ''.

Sample: Button menu with sub items


new FancyGrid({
  exporter: true,
  tbar: [{
    type: 'button',
    text: 'File',
    menu: [{
	  text: 'Export',
	  items: [{
	    text: 'Excel',
	    handler: function(){
  	      grid.exportToExcel();
	    }
	  },{
	    text: 'CSV',
	    handler: function(){
 	      grid.exportToCSV();
	    }
	  }],
	  '-',{
	  text: 'Hi',
	  handler: function(){
		alert('HI!');
	  }		
    }]
  }],
  ...

Sample: String and number items


new FancyGrid({
  tbar: [{
    type: 'button',
    text: 'File',
    menu: [{
	  type: 'string',
	  value: 'String',
	  events: [{
		input: function(field, value){
		  
		}
	  }]
	},{
	  type: 'number',
	  value: 7,
	  events: [{
		input: function(field, value){
		  
		}
	  }]
    }]
  }],
  ...

Sample: Context Menu

Context menu has several predefined item values: 'copy', 'copy+', 'delete', 'export'.

Screencast

You can study this section over screencast.


new FancyGrid({
  exporter: true,
  contextmenu: [
	'copy',
    'copy+',
	'-',
    'delete',
    '-',
    'export',
	'-',
	{
	  text: 'Custom',
	  imageCls: 'custom-menu-item-cls',
	  sideText: 'CUSTOM',
	  handler: function(){
		alert('Click on custom item');
	  }
  }],
  ...
`