Reputation: 15
I am trying to build a menu for use with jQuery contextMenu. It will be dynamic. I'm trying to add one element to it but it's reporting the error 'undefined is not a function'.
My menu works without the code that is trying to push the new element.
//Build the menu
var menudata = {
"Download Call": {name: "Download_Call"},
"sep1": "---------",
"View Comments": {name: "View_Comments"}
};
menudata.push (
{
"test": {name: "test"}
}
);
//Generate the context menu
$.contextMenu({
selector: '.context-menu-one',
trigger: 'left',
callback: function(key, options) {
var m = "clicked: " + key + " on " + $(this).attr('class');
alert(m);
},
items: menudata
});
I'm assuming it's a datatype issue but any help would be greatly appreciated.
Upvotes: 0
Views: 771