EasyUI Forum
October 19, 2025, 07:29:32 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: datagrid contextmenu  (Read 10525 times)
lexa
Newbie
*
Posts: 2


View Profile
« on: June 24, 2015, 01:53:42 AM »

Hi, All!
I'm a newby in EasyUI, but is very exited of it.
First of all i decided to write simple application for web, using EasyUI to look like usual windows program written in delphi.

My question is: in datagrid i can bind contextmenu ONLY to records of data, but not for entire table? if i have no record in table menu would not appear?

I've done what i need, but it looks not readable:

Code:
$('.datagrid-view .datagrid-view2 .datagrid-body').bind('contextmenu', function (e) { 
  ...
});

It's working, but... is there a more wright way to do this?

p.s. sorry for my poor english...
Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #1 on: June 24, 2015, 07:08:02 PM »

Please use the 'onRowContextMenu' event instead. If no row is clicked, the 'index' parameter value is -1. Before use this feature please download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4.2-patch.zip.
Code:
$('#dg').datagrid({
  onRowContextMenu:function(e,index,row){
  }
});
Logged
lexa
Newbie
*
Posts: 2


View Profile
« Reply #2 on: June 25, 2015, 03:57:36 PM »

Hi, jarry!

Thaks a lot. Exactly what i wanted and needed. Due to your help js code reduced significant!

Once more: Thank You.
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!