From efaa3cf827b66dd19838d465c4bf6ef913ad6c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Sun, 6 Jul 2014 18:12:07 +0200 Subject: [PATCH 1/2] provide userData to menu item functions --- contextMenu.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/contextMenu.js b/contextMenu.js index 8111748..7c0d89a 100644 --- a/contextMenu.js +++ b/contextMenu.js @@ -642,7 +642,17 @@ list.addClass('iw-mDisable'); } - list.bind('click', fun); + click = function () { + fun = this.fun.bind(this.userData); + fun( ); + } + + priv = { + userData: option.userData, + fun: fun + } + + list.bind('click', click.bind( priv )); //to create sub menu menuList.append(list); From 5498305f17f28332952d4907ff23e6c897b8aa04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Sun, 6 Jul 2014 18:12:46 +0200 Subject: [PATCH 2/2] close menu on menu item click --- contextMenu.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contextMenu.js b/contextMenu.js index 7c0d89a..0c722f4 100644 --- a/contextMenu.js +++ b/contextMenu.js @@ -643,11 +643,14 @@ } click = function () { + close = methods.close.bind(this.data); + close( ); fun = this.fun.bind(this.userData); fun( ); } priv = { + data: trgr, userData: option.userData, fun: fun }