Search
Close this search box.

Adding Items to the TM1 Web Right Click Menu

Within the TM1Web/Scripts folder open the ‘tm1webbook.js’ file within notepad or the preferred editor.
You should probably create a backup of this file before making any changes.

1.       The Menu Item ID

Press “ctrl+F” to bring up the find dialog – search for “var COPY”
On a blank line here create a name for your button and pick a number that is not in use within this section.
I chose:
“var TT = 991;”

2.       The “Create Menu Item” Script

In the next function called “function displaySpreadMenu(srcElem)” insert the following line at the point you wish your menu item to appear within the Menu.
“strHtml += addMenuItem(*MenuItemID*, *ButtonHoverText*, *IconName*, false, true);”
The Icon Name is the name of an Image that’s 16×16 pixels that exists in the “tm1web/images” directory
I put mine:
“strHtml += addMenuItem(TT, “TM1 Tutorials”, ‘TT.gif’, false, true);”
Before this line
“strHtml += addMenuItem(COPY, COPY_STR, ‘copy.gif’, false, true);”
Which made it the first Menu Item.

3.       The “OnClick” Events

Within the “function itemOn(item)” function
After the line that states “var iMenu = parseInt(delem[2]);”
Insert the following:
                if( iMenu == *MenuItemID* )
                {
                                *Do something relevant*
                }
I chose to make the Menu Item open the site www.tm1tutorials.com
Here is the code:
                if( iMenu == TT )
                {
                                window.open(“https://www.tm1tutorials.com”,”_new”);
                }

Probably not that useful but fun none the less.

  • This field is for validation purposes and should be left unchanged.

Leave a Reply

Your email address will not be published. Required fields are marked *

Log In