Document the use of the show event to set the title of a dynamic menu
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 55/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, jquery
- Domain
- documentation
Research direction
Start with the documentation for menus created through the build function and review the existing guidance for show events and dynamic titles. Add the provided dynamic-menu example or equivalent explanation, then verify that users can find how to set a title from the triggering element.
Written by the indexing model from the issue text.
Description
Hi,
This is a suggestion to improve the documentation.
For menus using the 'build' function, the only way I found to set the menu title was to do it in the show event.
$.contextMenu({
selector: '.ui-timeline-key',
className: 'ui-contextmenu-title-key',
build: function ($trigger, e) {
return {
callback: function (key, options) {
var m = "clicked: " + key;
window.console && console.log(m) || alert(m);
},
items: keyContextMenuItems
};
},
events: {
show: function (options) {
//this refers to the triggering element
//read a custom data of the triggering element
var keyName = this.attr('data-key');
//set a custom menu title using the javascript method
$('.ui-contextmenu-title-key').attr('data-menutitle', "key " + keyName);
return true;
}
}
});
I thihk it would be nice to add it to the documentation, I almost gave up on the lib because this appeared to not be supported. Most of my usage cases require dynamic menus and having a dynamic title is a really nice feature.
Thanks!
- Dominant language
- JavaScript
- Stars
- 2.2k
- Forks
- 721
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from swisnl/jQuery-contextMenu
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
swisnl/jQuery-contextMenu#759 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
swisnl/jQuery-contextMenu#726 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
swisnl/jQuery-contextMenu#725 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
swisnl/jQuery-contextMenu#724 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
swisnl/jQuery-contextMenu#723 ·
All issues in swisnl/jQuery-contextMenu
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
avniproject/avni-client#2135 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bevyengine/bevy-website#2595 ·
-
ecosystem wording
Difficulty 1/5 Under an hour Newbie friendliness 90/100
matrix-org/matrix.org#3649 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vadimdemedes/ink#1029 ·