Subscribe via Feed
, Jan 17, 2010 9:54:49 PM
5 responses to Custom-Control 2 Custom-Control Communication
Lenni Sauve, April 18, 2011 3:02 PM
Don't worry about replying to my question - IBM support found the answer in the Mastering xPages book. I'm still waiting for my copy to arrive!
Lenni Sauve, April 17, 2011 9:49 PM
Lance, I hope this doesn't sound goofy, but could you please explain how to accomplish item c in a little more depth?
I've been trying to pass the value of a computed field from one custom control to another and can't seem to get it to work.
When I create the Property Definition in the custom control with the field on it, if I select string as the Type, then I can see the property as a Custom property in the xPage for that custom control, however, if I try to set the value by using getComponent("EmployerID").getValue() because the EmployerID field does exist on that custom control, so it should be visible, I receive the error getComponent is null.
If I select DominoDocumentData as the Type for the Property Definition, as I think I should because I would be obtaining the value of a field on the document itself, the property does not display on the xPage for the custom control at all.
Where is my logic incorrect?
John Smart, March 23, 2010 5:55 AM
I was trying to do this same thing. I'm making a dialog that might be called from several places, so there's a one-to-many between my "dialogGuts" control and the several "dialogLaunchButton" controls, and was trying to figure out how the buttons will find the id of the dialog panel to tell it to open.
Now that I read your article, I'm instead going to use dojo.publish('/myApp/myDialog/OpenRequested') on the button controls, and use dojo.subscribe('/myApp/myDialog/OpenRequested', objectContainingHandlerMethod, stringNameOfHandlerMethod) within the dialog control's onload.
Which is really how I should have been trying it in the first place!
Vikas Tiwari, February 17, 2010 8:33 AM
I also faced the similar issue, then I found Dojo to the rescue. dojo.query saved lot's of time for me and is very reliable across browsers.
Let's say, we want to access a Panel with Id: "pnlTest" and at runtime Domino will generate id something like: "view:_id1:pnlTest".
Instead of worrying about getComponent() method, we can run dojo.query() to extract elements that end with "pnlTest".
var elem = dojo.query("[id$='pnlTest'");
Another Sample code:
var wl =dojo.query("a[id$='lnkProfileImage']");
I hope it helps.
Lenni Sauve, January 18, 2010 4:51 PM
Thanks so very much for that information Lance! This is exactly what I'm having problems with - knowing what items can 'see' what other items and how to work around that. Please do post anything further you find on this subject.