EasyUI Forum
May 14, 2024, 04:02:14 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: context menu issue in treegrid and datagrid (ver 1.4.3)  (Read 5728 times)
what_tahw
Newbie
*
Posts: 3


View Profile
« on: October 11, 2015, 09:07:57 PM »

in 1.4.3 version, when right click inside treegrid/datagrid control, but outside data rows, would trigger context menu.
but at that time, id is "null",
so we might got this error message: "Uncaught TypeError: Cannot read property 'id' of null"
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: October 11, 2015, 11:54:51 PM »

You have to detect if the 'row' parameter is null in the 'onContextMenu' function.
Code:
function onContextMenu(e,row){
if (row){
e.preventDefault();
$(this).treegrid('select', row.id);
$('#mm').menu('show',{
left: e.pageX,
top: e.pageY
});
}
}

Please refer to http://www.jeasyui.com/demo/main/index.php?plugin=TreeGrid&theme=default&dir=ltr&pitem=TreeGrid%20ContextMenu
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!