Customizing the UI with Ajax
Objective
This section will describe how to dynamically update a portion of a Windchill page by:
1. Using the partial page refresh capabilities built into the Windchill action and form processing frame workor
2. Making an Ajax call to the Method Server directly from your JavaScript code.
Scenario 1
A UI component on your page executes an action. When the action completes, you would like to update a portion of the launch page to reflect the results of an action.
Example: A user launches a wizard to create a new part from the folder browser of a product. When the user clicks OK you send the form to the server and create the part. After doing so, you would like to add a row to the folder browser table that displays the part just created.
Example: A user clicks a menu item in a product folder browser to delete a document. The menu item action calls a command to delete the object from the database. When the command completes, you would like to delete the row for that object from the folder browser table.
Solution: Use the partial page refresh capabilities built into the Windchill action and form/command processing framework
Scenario 2
You would like to refresh an inline element of the page when some event occurs
Example: You have a page that displays time values in a default time zone. It also has a button that allows the user to change the time zone. When the user changes the time zone, you want to redisplay the time values accordingly.
Solution: Add an onChange event handler for the time zone button that calls the requestHandler.doRequest() JavaScript function to recompute the time display value.
Background
To make the Windchill product faster and more scalable, it is necessary to use some Ajax based operations to cut down on the refresh times of pages. All actions should be Ajax based where possible. The only actions that should not be Ajax based are those that require most of the page to be updated.
這是否有幫助?