3 Replies Latest reply on Nov 19, 2008 9:03 AM by Ilya Shaikovsky

    Listing hotKeys active for a page

    Jason Long Master

      Is there any way to list the currently active rich:hotKeys for a given page using javascript or otherwise?

      I would like to let the user see what hotKeys will work. This could be a modal panel or tool tip or whatever.

      I might be nice to add a title, or description to rich:hotKey so that this could be displayed as well.

      Thank you for your advice in advance.

        • 1. Re: Listing hotKeys active for a page
          Nick Belaevski Master


          Try this:

          <body onload="showMappings()">
           <rich:hotKey key="alt-a" selector="span" />
           <rich:hotKey key="shift-b" selector="span" />
           <rich:hotKey key="c" selector="span" />
           <script type="text/javascript">
           function showMappings() {
           var mappings = {};
           var all = jQuery.hotkeys.all;
           if (all) {
           for ( var name in all) {
           var elt = all[name];
           if (elt.events) {
           for (var eventName in elt.events) {
           var combi = elt.events[eventName];
           if (combi.callbackMap) {
           for (var key in combi.callbackMap) {
           mappings[key] = true;
           var result = new Array();
           for (var mapping in mappings) {

          • 2. Re: Listing hotKeys active for a page
            Jason Long Master

            That works quite nicely.

            Thank you for the tip.

            I would now like to display some information about what the hotkey will do.

            I guess I could tie this to my messages, but different hotkeys could do different things on different pages.

            Any advice on the best way to implement this?

            • 3. Re: Listing hotKeys active for a page
              Ilya Shaikovsky Master

              As for me I think messages is a good enough to perform this. You could just create alternate messages for some hotKeys which could be defined with the different meaning.