Implementing External Client-Side Triggers and Operations
You can create your own JavaScript definitions using your preferred editor. However, the operations or triggers must be made available in the runtime component.
-
In the Script container of a DSP component:
- Use the weboperation ProcScript instruction to declare client-side operations.
- Use the webtrigger statement to declare client-side interactive triggers such as detail.
-
If required, define a
scope and params block.
weboperation Refresh scope input output endscope end; weboperation Refresh
-
Create the JavaScript implementations of the
operations and triggers, either in the DSP layout or in a .js file that has
the same name (in lowercase) as the DSP.
The JavaScript definitions must conform to the Data Format of External Client-Side Triggers and Operations and they must be added as members to the
uf_clientside
object.For example, in the DSP layout, you can use the
<script>
tag to add the following JavaScript definitionsvar uf_clientside = uf_clientside || {}; uf_clientside.MUSICLIST = { "refresh" : function() { alert("Refresh of " + this.getName() + " called." ); }, "ITEMID.ITEMS.MUSICSHOP" : { "detail": function() { alert("Detail trigger of field " + this.getName() + " invoked."); } } };
-
If your JavaScript has dependencies on the
Uniface JavaScript (and CSS), you can control the point at which the Uniface JavaScript is loaded
by inserting a placeholder,
<--UNIFACEJS-->
.For more information, see Controlling the Load Order of JavaScript and CSS .