[SOLVED] Controlling tab positions

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Posts: 12
Joined: Sat Sep 13, 2014 1:01 am

[SOLVED] Controlling tab positions

Postby cmac » Thu Feb 11, 2010 8:36 am

One of my challenges for this project I am working on is to add a new 'Tab' Application / Zimlet, but the tab itself needs to be the second tab in the row appearing after the MAIL tab.
I have tried looking for some sort of control for this handling this, but I am either overlooking it or there is nothing really written on this.
Would something like this be accomplished by editing one of the initial .js files like zimbra.js or startup? If so, can anyone target a specific area of the code?
Can anyone offer advice?

Advanced member
Advanced member
Posts: 114
Joined: Sat Sep 13, 2014 12:45 am
Location: Tokyo

[SOLVED] Controlling tab positions

Postby 10539yutaka » Thu Feb 18, 2010 5:14 pm

Hi cmac,
You better see ZmAppChooser.js, which is the container for application tabs.
When you do "createApp" in your zimlet, it actually execute ZmZimletBase.js 's createApp. And In that function, you get the appchooser and execute addButton of it like below.
[QUOTE]controller.getAppChooser().addButton(appName, {text:label, image:image, tooltip:tooltip});[/QUOTE]
But this method can not be called with some index, which specify where the button should be added. So the button gets added at the last in the row.
If you want to modify Zimbra's original source code, maybe you can add one method like addButton to ZmAppChooser.js, but with index parameter like;
[QUOTE]insertButton(appName, {text:label, image:image, tooltip:tooltip,index:index});[/QUOTE]
Implementation of this method could be as exactly same as addButton method.

But the only difference is "buttonParams", which is used as parameter when executing constructor of ZmAppButton

and it should include "index:params.index".
Then you can exectute the method something like this in your zimlet.

[QUOTE]controller.getAppChooser().insertButton(appName, {text:label, image:image, tooltip:tooltip, index:2});[/QUOTE]
I did not try this idea yet.

So it is great if you try and tell me result.
I hope it will help you.
Advanced member
Advanced member
Posts: 103
Joined: Sat Sep 13, 2014 12:51 am

[SOLVED] Controlling tab positions

Postby sposetti » Fri Feb 19, 2010 1:10 pm

Instead of overwriting the core code in ZmZimletBase.js (and avoid that getting overridden when you upgrade), you can call the code to construct the tab directly in your zimlet for now.
Here is example code that you would call in your zimlet init() function to create the tab. Notice the index is being set as one of the params sent to addButton():

com_zimbra_example_simpletab_HandlerObject.prototype.init =

function() {
var label = "Simple Tab App";

var image = "zimbraIcon";

var tooltip = "A simple app in a new tab";

var index = 2;

var params = {






var appName = [this.name, Dwt.getNextId()].join("_");

var controller = appCtxt.getAppController();

var appChooser = controller.getAppChooser();

appChooser.addButton(appName, params);
var app = new ZmZimletApp(appName, this, DwtShell.getShell(window));

this._simpleAppName = appName


We have filed and are making this enhancement to add support for setting the index when creating the tab. This will become available with ZCS 6.0.6 and when that happens, you can return to using ZmZimletBase.createApp() and optionally specify an index (vs. using the code above):
Bug 44720 – Tab Zimlet support for index
Posts: 12
Joined: Sat Sep 13, 2014 1:01 am

[SOLVED] Controlling tab positions

Postby cmac » Thu Feb 25, 2010 10:58 am

Thanks very much!
Once I changed "_simpleAppName" (in the last line of your code) to my own application name, and commented out my original two lines in my init function, everything just worked without modifying or changing anything else.
Glad to also hear it will be a fix in the new release!

Return to “Developers”

Who is online

Users browsing this forum: No registered users and 3 guests