There is a way to make it work even when user changes the views.
There is a zimlet hook called onShowView which is called by core-zimbra whenever there is a change in view. And you can do whatever you need when that is called.
Here is an example usage:
Code:
com_zimbra_myzimlet.prototype.onShowView = function(viewId, isNewView) {
if(viewid != ZmId.VIEW_CONVLIST || viewid != ZmId.VIEW_TRAD)
return;
if...
<add code to check if traditional and conversation view already has button, if so exit from funtion>
//call inittoolbar to add button..
this.initToolbarButton();
};
PS: I wouldn't generally add it in this context since users don't change views on a daily basis and also due to performance reasons since this method is called for all views. You might want to make-sure you do all proper checks before using this.