i am using contexMenu by SWIS and i don't know how can i change the selected vale from a checkbox. i have this code:
function isOk(){
return false;
}
$.contextMenu({
selector: "td[name*='someSelector']",
callback: function(key, options) {
var m = "clicked: " + key + " id: "+ this.attr('id');
window.console && console.log(m) || alert(m);
},
items: {
"okOption": {
name: "ok",
type: 'checkbox',
selected: function(){ return isOk(); }
},
"quit": {
name: "Close Menu",
icon: function(){
return 'context-menu-icon context-menu-icon-quit';
}
}
}
});
But the checkbox is always true.
I don't know what is wrong or if the selected doesn't works with a function and only works with a true or false.
function isOk(){
return false;
}
$.contextMenu({
selector: "[name*='someSelector']",
callback: function(key, options) {
var m = "clicked: " + key + " id: "+ this.attr('id');
window.console && console.log(m) || alert(m);
},
items: {
"okOption": {
name: "ok",
type: 'checkbox',
selected: {function(){ return isOk(); }}
},
"quit": {name: "Close Menu", icon: function(){
return 'context-menu-icon context-menu-icon-quit';
}
}
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.js"></script>
<script src="https://swisnl.github.io/jQuery-contextMenu/js/theme.js"></script>
<link href="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.css" rel="stylesheet"/>
<span name="someSelector"> ClickRightHere</span>