Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contex menu misplaced #725

Open
jzav opened this issue Jun 12, 2020 · 0 comments
Open

Contex menu misplaced #725

jzav opened this issue Jun 12, 2020 · 0 comments

Comments

@jzav
Copy link

jzav commented Jun 12, 2020

Hello,
please see https://i.imgur.com/DDDAlOi.png.
Right-clicked dd. Context menu seems to be misplaced and only partly visible.
Use ag-grid library -> https://www.ag-grid.com/
My project -> https://addons.mozilla.org/en-US/firefox/addon/at-your-command/

Code:

$(function() {
	$.contextMenu({
		selector: '.context-menu-one', 
		callback: function(key, options) {
			var m = "clicked: " + key;
			window.console && console.log(m) || alert(m); 
		},
		items: {
			"edit": {name: "Edit"},
			"cut": {name: "Cut"},
		   	"copy": {name: "Copy"},
			"paste": {name: "Paste"},
			"delete": {name: "Delete"}
		}
	});

	$('.context-menu-one').on('click', function(e){
		console.log('clicked', this);
	})    
});

Tried to add context menu via cell renderer:

function cRendererNewFolder(params) {
	params.eGridCell.addEventListener('keydown', onCellKeyDown);
	params.eGridCell.addEventListener('keyup', resetShift);
	var hodnota = '';
	if (params.value == undefined) {
		hodnota = '';
	} else {
		hodnota = params.value.toString();
		hodnota = hodnota.replace(/</g, "&lt;").replace(/>/g, "&gt;");
	}
	var icon = browser.extension.getURL('icons/iconfinder_Folder_Win_1215244.png');
	var element = document.createElement("span");
	element.style = "padding-left:" + (params.data.indent * 21) + "px";
	var imageElement = document.createElement("img");
	imageElement.src = icon;
	imageElement.width = "18";
	imageElement.height = "18";
	imageElement.style = "vertical-align: middle;"
	element.appendChild(imageElement);
	var textElement = document.createTextNode(' ' + hodnota);
	element.appendChild(textElement);
	element.className = "context-menu-one";
    return element;
}
@jzav jzav changed the title Contex menu misplaced and hidden under grid div Contex menu misplaced Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant