Create a MCO to use a JavaScript file that the client loads dynamically to handle client events.
To create a MCO for your application, follow these steps:
1. Start the Managed Client Object wizard, either:
- Click
on the toolbar, or
Note: For the
icon to appear on the Studio toolbar, you must add the Nexaweb Element Creation toolbar, see Nexaweb Studio Toolbars.
- Select File > New > Managed Client Object, or
- Click
and select Managed Client Object
A File Settings dialog appears similar to Figure 30.
2. Complete the File Settings dialog as follows:
|
Figure 30. File Settings dialog. |
Enter or select the parent folder: Nexaweb Studio selects src-js, the default folder for MCOs in an Ajax project by default. Keep the default location or use the selection box to choose another location. File name: Nexaweb Studio automatically specifies a file name for a JavaScript MCO as jsMCO.js. Enter a new file name in this field. Advanced: Optionally click Advanced to select an existing file in the project to use for this MCO. |
Click Next.
The Function Settings dialog appears.
3. Complete Function Settings dialog as follows:
|
Figure 31. Function Settings dialog |
Component Events: Scroll through the list of component events to locate the component type for which you want to add an MCO and select the appropriate event type. Function name: Nexaweb Studio displays the event type selected in the Component Events selection box. |
4. To add parameters to pass to this event, click Next.
An Optional Settings dialog appears.
Otherwise click Finish.
5. Complete the Optional Settings dialog as follows:
|
Figure 32. Function Settings dialog |
Add: Click Add to add a parameter for this MCO. Enter a parameter name in the text box and click OK. To remove a parameter, select it and click Remove. Use the Move Up/Down buttons to change the order of parameters in the list. Add Another Managed Client Object: Click the checkbox beside Add Another Managed Client Object to add another MCO. |
6. Click Finish.
Nexaweb Studio creates a JavaScript file in [workspace]/[ApplicationName]/WebContent/src-js] or in the directory that you specified, if any. Nexaweb studio displays a dialog prompting to open the MCO file now.
7. Click Yes to open the file now, or No if you do not want to open the file.
To assign this MCO to a component, see Connecting Business Logic to the User Interface.