I have received feedback from users working with JET UI – sometimes it is not obvious that action button was pressed, users tend to press same button again very fast, which leads to parallel REST calls executing at the same time. In JET – REST call is executed asynchronously, this makes user to believe action was done instantly when button was pressed. However, REST call still may run in the background – while user will be trying to call same service again. While in most of the cases such behaviour is fine, still there are use cases when we want to block action button, until REST response is not received (while response is executed, button will be disabled – this will give visual feedback to the user about action still executing). JET provides Busy Context API to handle asynchronous REST calls in synchronous way.
I will describe how to apply Busy Context API in your JET application. Take a look into my sample app (JET + ADF BC REST) available on GitHub – JETCRUD. When you run sample app, go to Customers tab and navigate to edit screen. There you will find Save button, which is enabled:
Save button calls saveCustomer() JS function. JET Busy Context is established in this method, before making REST call. Busy Context is attached to Save button. If there are no busy states in the context, function isReady() returns true and we can register busy context. After busy context is registered – REST call can be made. If saveCustomer() JS function will be called again, before REST call is executed – isReady() will return false and no REST call will be made. When busy state is created, we update observable variable – which helps to change disabled property for the button: Read the complete article here.
For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.