We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

displaying shortcuts

Thread ID:





141813 Jan 5,2019 07:06 AM UTC Jan 7,2019 12:17 PM UTC JavaScript - EJ 2 1
Tags: Menu
Asked On January 5, 2019 07:06 AM UTC

Is there a way to display keyboard shortcut e.g Ctrl+C to the right of a menu item.

Silambarasan I [Syncfusion]
Replied On January 7, 2019 12:17 PM UTC

Hi Sampurnima, 
Thank you for contacting Syncfusion support. 
We have looked into the reported query and we would like to let you know that, your requirement “customize to display keyboard shortcut e.g Ctrl+C to the right of a menu item” can be achievable by using ‘template’ property in EJ2 Menu. In the following code example, we have added some menu items with shortcut info. Please refer the below screenshot. 
Sample Link: 
import { Menu } from '@syncfusion/ej2-navigations'; 
import { enableRipple } from '@syncfusion/ej2-base'; 
//Menu items datasource 
let menuItems: { [key: string]: Object }[] = [ 
    text: 'File', 
    iconCss: 'em-icons e-file', 
    text: 'Edit', 
    items: [ 
      { text: 'Cut', shortcut: 'Ctrl + X' }, 
      { text: 'Copy', shortcut: 'Ctrl + C' }, 
      { text: 'Paste', shortcut: 'Ctrl + V' } 
let templateStr: string = '<span>' + 
            '${if(iconCss)}<span class="e-menu-icon ${iconCss}"></span>${/if}' + 
            '${if(text)}${text}${/if}' + 
            '${if(shortcut)}<span class="e-shortcut-elem">${shortcut}</span>${/if}' + 
// Initialize Menu component. 
let menuObj: Menu = new Menu({ 
  items: menuItems, 
  fields: { 
    text: 'text', 
    children: ['items'] 
  template: templateStr 
}, '#menu'); 
Could you please check the above sample and get back to us if you need any further assistance? 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon