问题
I have a custom control having a but submit and multiple SSJS libraries. I have require a global array initialized in in submit button and array values are populated from different libraries. I have declared and initialized an array button but its not available in libraries. Any clue how can I declare an array as global to make this available for all libraries? If not than how an array can be created using scope variables?
Please guide me . Thanks in advance
Best Regards,
Qaiser
回答1:
You could define it as a viewScope array - this question ... xPages repeat control with scoped variable as data source .. isn't directly about that, but shows how to define an array via viewscope.
essentially for a one-dimentional array, it would be:
viewScope.myArray=["1","2","3"];
You can define it in the event on thye xpage :
<xp:this.beforePageLoad>
<![CDATA[#{javascript:viewScope.myArray = ["1","2","3"];}]]>
</xp:this.beforePageLoad>
来源:https://stackoverflow.com/questions/26929374/creating-global-array-in-in-xpages-using-ssjs