How can I set a custom control property from SSJS?
The problem that I have is that I can only set property values if my code runs on the same Custom Control; for example:
compositeData.viewname = ‘People’;
But what I want to do is to set this property from my holding XPage; I’ve tried setting the value from a button using:
var cc = getComponent(‘ccname’);
cc.setValueBinding( ‘viewname’, ‘People’ );
cc.compositeData.viewname = ‘People’;
cc.compositeData.setValue(‘viewname’, ‘People’);
compositeData.viewname = ‘People’;
without any success.
Please your help.
Subject: You can’t? (grin)…
<xc:CustomControl someProperty=“#{javascript:your SSJS goes here}” />
Caveat: You can not put && or " in the code. You can include a server-side JS library and put a function in there, though, and do pretty much whatever you darned well please.
Hope this helps…
Subject: Scope variables instead?
Thanks David, but, inline SSJS is not an option since what I want is to call a Dojo dialog (custom control) multiple times from my XPage using buttons.
The idea of using Custom Control Properties was to set the value of this property every time I call the dojo dialog with a different view name.
I think I’ll change this approach to use viewScope variable to store the viewname. For example:
Button 1
viewScope.put(‘viewname’, ‘People’)
Button 2
viewScope.put(‘viewname’, ‘PeopleandGroups’)
Thanks