[SOLVED] Creating a new tag menu
Posted: Wed Jun 08, 2016 4:55 pm
Hello guys,
I think you could have guessed from the post's title that I'm trying to create a new tag menu by myself.
Pretty straight forward. So i'm getting the menu created, but is is empty. I thought it would have been populated as I wanted to on its creation. After lookin at the source code, it seems like the _render(tagList, addRemove) method is responsable for that, and it isn't called in the constructor. So i'm trying to call it, but I'm getting an error caused because I just don't know how to get back the addRemove parameter... I've searched pretty much anywhere I could, or at least i think so...
It seems like it is searching for the existing tags in the addRemove array, but how can i get the addRemove array back? Where from? Additionally, will this build the tag menu as I want it?
I think you could have guessed from the post's title that I'm trying to create a new tag menu by myself.
Here's the code that I use to create my new tag menu (I am calling this function in the initializeToolbar(app, toolbar, controller, viewId) method in my zimlet):TL;DR:I want to have the tag menu in the actions menu in the toolbar. The way i'm trying it is by creating a new ZmTagMenu in the actions menu. The menu creation is working, but i can't get it to populate with the create tag & delete tag and the existing tags as I thought it could. I am trying to use the _render(taglist, addRemove) method which looks like it can do that job for me, but I can't wrap my head around how to get the addRemove[] array needed.
Code: Select all
ZmEnhancedToolbar.prototype._setActionsMenu =
function(toolbar) {
var actionsMenu = toolbar.getActionsMenu();
actionsMenu.createSeparator();
var subTagButton = actionsMenu.createOp("tag_submenu", {
text: "myTagMenu"
});
var subTagMenu = new ZmTagMenu(subTagButton);
subTagMenu._render(appCtxt.getTagTree(), /*addRemove*/);
subTagButton.setMenu(subTagMenu);
}
Code: Select all
Uncaught TypeError: Cannot read property 'add' of undefined