EasyUI Forum
October 10, 2024, 10:01:33 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: Unique context menu for each record in datagrid  (Read 14006 times)
mzeddd
Full Member
***
Posts: 223



View Profile
« on: November 17, 2011, 10:56:48 AM »

Hi,

Depending of field value I'd like to have different context menus for records in DataGrid

How can I recreate already created menu or update existing one?

Now I have this:

Code:
onRowContextMenu: function(e, rowIndex, rowData){
e.preventDefault();
$(this).datagrid('unselectAll');
$(this).datagrid('selectRow', rowIndex);
if (!$('#tmenu').length){
var tmenu = $('<div id="tmenu" style="width:120px;"></div>').appendTo('body');
$('<div />').html('Edit').appendTo(tmenu);
$('<div />').html('Import').appendTo(tmenu);
$('<div />').html('Lock').appendTo(tmenu);
$('<div />').html('Unlock').appendTo(tmenu);
$('<div />').html('Activate').appendTo(tmenu);
$('<div />').html('Deactivate').appendTo(tmenu);
$('<div />').html('Clear').appendTo(tmenu);
tmenu.menu({
onClick: function(item){
// do smth
}
});
}
if(rowData.state=='Open'){
// update menu for record with is 'Open'
}
if(rowData.state=='Locked'){
// update menu for record with is 'Locked'
}
if(rowData.state=='Inactive'){
// update menu for record with is 'Inactive'
}
$('#tmenu').menu('show', {
left:e.pageX,
top:e.pageY
});
}
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!