Get attachments_btn object

Interested in talking about Mash-up's? This is the place.
Post Reply
DMK
Posts: 2
Joined: Wed Aug 10, 2016 1:59 pm

Get attachments_btn object

Post by DMK »

I am working on a Zimlet that needs to get attachment button object from UI client interface, the problem that the ID of that attach_btn change in every Zimbra reload, so I can't get that object , I tried this solution to get the object using my browser console :
var menu = DwtControl.fromElementId("zb__COMPOSE5___attachments_btn").getMenu();
The last line works for me but is not a dynamic one because that id change in every reload any one can help !
DMK
Posts: 2
Joined: Wed Aug 10, 2016 1:59 pm

Re: Get attachments_btn object

Post by DMK »

And the solution is :
var sessionComposeId = appCtxt.composeCtlrSessionId ;
alert("My New Session ID = "+sessionComposeId);
var attachBtnId = "zb__COMPOSE-"+sessionComposeId+"___attachments_btn";
// the line below is for getting menu from attach button
var menu = DwtControl.fromElementId(attachBtnId).getMenu();
vdagost-fr
Posts: 43
Joined: Mon Apr 11, 2016 11:59 am

Re: Get attachments_btn object

Post by vdagost-fr »

Hi

I may have a similar problem ...

I'm trying to get the id of the "New signature" button (which is in the signatures preference menu) to change its behavior (set a new listener).

Its internal ID changes at each webmail reload. How could I get its internal id using javascript ?

With Firebug i've found the css class and its random html class name Dwtxxx and in the java zimbra source code i've found a hint :

Code: Select all

// Signature ADD
var addEl = document.getElementById(this._htmlElId + "_SIG_NEW");
var button = new DwtButton(this);
button.setText(ZmMsg.newSignature);
button.addSelectionListener(this._handleAddButton.bind(this));
this._replaceControlElement(addEl, button);
this._sigAddBtn = button;
But I did not find how to use it :(

Regards
Victor
Post Reply