EasyUI Forum
April 30, 2024, 09:09:44 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: adding menu items  (Read 4386 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: January 25, 2015, 06:58:56 PM »

The onclick event for a menus added as per this does not appear to fire.

Code:
$('#mm').menu('appendItem', {
parent: item.target,  // the parent item element
text: 'Open Excel',
iconCls: 'icon-excel',
onclick: function(){alert('Open Excel')}
});

If I add using this method, then the onclick event fires when the menu is added:

Code:
$('#mm').menu('appendItem', {
parent: item.target,  // the parent item element
text: 'Open Excel',
iconCls: 'icon-excel',
onclick: alert('Open Excel')
});
Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: January 26, 2015, 12:06:09 AM »

The 'onclick' property value should be a string or a function.
Code:
onclick: function(){alert('Open Excel')
or
Code:
onclick: "alert('Open Excel')"
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!