how to hide one of the option in contextMenu on one of the row not all
how to hide one of the option in contextMenu on one of the row not all
MA_abdallah
Posts: 3Questions: 1Answers: 0
$.contextMenu({
selector: '.context-menu-one',
callback: function (key, options) {
var userId = $(this).attr('id');
if (key == 'Details')
GetUserDetails(userId);
if (key == 'Reset') {
$("#hd_resetItem").val(userId);
debugger;
if (userId != 554) {
$.magnificPopup.open({
items: {
src: '#reset_pass',
type: 'inline'
},
modal: true
});
}
}
if (key == 'Unlock') {
$("#hd_unlock").val(userId);
$.magnificPopup.open({
items: {
src: '#unlockacc',
type: 'inline'
},
modal: true
});
}
if (key == 'Delete') {
$("#hd_DeletedItem").val(userId);
$.magnificPopup.open({
items: {
src: '#modelRoll',
type: 'inline'
},
modal: true
});
}
if (key == 'Edit')
window.location = ROOT + 'Account/user/' + userId;
if (key == 'Log')
window.location = ROOT + "Account/UserLog?id=" + userId;
},
items: {
"Details": { name: "User Details", icon: "fa-info" },
"Log": {
name: "User Log", icon: "fa-archive ", disabled: function (key, opt) {
return $("#MainContent_hdl").val() != '1';
}
},
"Edit": {
name: "Edit", icon: "fa-pencil-square-o", disabled: function (key, opt) {
return $("#MainContent_hde").val() != '1';
}
},
"Delete": {
name: "Delete", icon: "fa-trash", disabled: function (key, opt) {
return $("#MainContent_hdd").val() != '1';
}
},
"Reset": {
name: "Reset Password", icon: "fa-refresh", disabled: function (key, opt) {
return $("#MainContent_hdr").val() != '1';
}
},
"Unlock": {
name: "Unlock User", icon: "fa-unlock", disabled: function (key, opt) {
return $("#MainContent_hdlk").val() != '1';
}
}
}
});
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
Is this a DataTable issue? I'm not seeing any DataTable code there,
Colin
yes its in datatable contextMenu
I may be wrong but I don't believe Datatables has a contextMenu. Maybe you are using this plugin. If its a Datatables provded plugin please point us to the documentation page. If not use the plugin's support mechanism or Stack Overflow for questions.
Kevin
thanks all found a function that helped me
add in row 254
"Reset": {
to hide option for one of the row