Hi,
I would like to use qooxdoo events (button click, radiobox selection change etc.) to collect host data (grid/ texts) and then manipulate the same (calculate totals from detail amounts, change color coding based on host condition, etc.) on the front-end side. Is there any example to achieve this?
Thanks,
Anand Rajamani.
------------------------------
Anand Rajamani
------------------------------
I would like to use qooxdoo events (button click, radiobox selection change etc.) to collect host data (grid/ texts) and then manipulate the same (calculate totals from detail amounts, change color coding based on host condition, etc.) on the front-end side. Is there any example to achieve this?
Thanks,
Anand Rajamani.
------------------------------
Anand Rajamani
------------------------------
Page 1 / 1
Hi,
I would like to use qooxdoo events (button click, radiobox selection change etc.) to collect host data (grid/ texts) and then manipulate the same (calculate totals from detail amounts, change color coding based on host condition, etc.) on the front-end side. Is there any example to achieve this?
Thanks,
Anand Rajamani.
------------------------------
Anand Rajamani
------------------------------
I would like to use qooxdoo events (button click, radiobox selection change etc.) to collect host data (grid/ texts) and then manipulate the same (calculate totals from detail amounts, change color coding based on host condition, etc.) on the front-end side. Is there any example to achieve this?
Thanks,
Anand Rajamani.
------------------------------
Anand Rajamani
------------------------------
This is definitely possible. Instead of giving an example I can guide you through the steps here to make this possible.
Best practice it to use a Rocket MX script to retrieve the information to be provided to your JavaScript.
Our client's JavaScript API can also be configured to allow to get any host field value or global variable from JavaScript, but we recommend to create functions to get only the information needed. This to prevent misuse, as opening up the API too much could make your web application vulnerable.
In my example I've created a Rocket MX script function to retrieve a System, SubSystem and DeviceName from the logon screen:
Next, I made a JavaScript function to use the API 'scriptFunctionCall' to call this function, obtain the outcome and just alert() on the outcome.
This is just an example that displays the contents of the fields in an alert, but you can both put and get variables this way to Rocket MX script functions. and use these in JavaScript.
As a function may take some time to complete the call is asynchronous. The scriptFunctionCall will invoke the function and on completion it will call the 'callback function' with the results. You can both capture the return value (in my example called result) as well as the variables passed 'by reference'. Although we call them "by reference" when we return updated arguments, technically these will be copies of the outcome - so changing them in JavaScript will have no effect in the Rocket MX script. To change these and send them back to the session another script function should be made for updating.
Also note that the names of returning values are uppercased, because JavaScript is case sensitive but Rocket MX script is not. To avoid challenges the variable names will always be uppercased.
Next step is to bind the JavaScript to a button.As example we will bind this to a button on a panel, on the OnCommand event:
And lastly, the API will not be enabled by default.
To do so you can enable the API and the allowed function in the deployment.properties file.
For instance like this:
As explanation:
servlet.host_api=true --> turns on the API
servlet.host_api_access_control_order=deny-allow --> sets the order to first process the denials, then the allowances
servlet.host_api_access_control_deny=* --> deny everything
servlet.host_api_access_control_allow=scriptFunctionCall,RetrieveValues --> except call to scriptFunctionCall and RetrieveValues
This will allow only these two calls in the API, keep all other access closed to avoid any misuse for a safe setup.
When all is configured, my live test gives the following outcome when I click the button:
Hope this clarifies and helps,
Best regards,
------------------------------
Roger van Valen
Senior manager, software engineering
Rocket Software
Dordrecht, The Netherlands
------------------------------
Hi Anand,
This is definitely possible. Instead of giving an example I can guide you through the steps here to make this possible.
Best practice it to use a Rocket MX script to retrieve the information to be provided to your JavaScript.
Our client's JavaScript API can also be configured to allow to get any host field value or global variable from JavaScript, but we recommend to create functions to get only the information needed. This to prevent misuse, as opening up the API too much could make your web application vulnerable.
In my example I've created a Rocket MX script function to retrieve a System, SubSystem and DeviceName from the logon screen:
Next, I made a JavaScript function to use the API 'scriptFunctionCall' to call this function, obtain the outcome and just alert() on the outcome.
This is just an example that displays the contents of the fields in an alert, but you can both put and get variables this way to Rocket MX script functions. and use these in JavaScript.
As a function may take some time to complete the call is asynchronous. The scriptFunctionCall will invoke the function and on completion it will call the 'callback function' with the results. You can both capture the return value (in my example called result) as well as the variables passed 'by reference'. Although we call them "by reference" when we return updated arguments, technically these will be copies of the outcome - so changing them in JavaScript will have no effect in the Rocket MX script. To change these and send them back to the session another script function should be made for updating.
Also note that the names of returning values are uppercased, because JavaScript is case sensitive but Rocket MX script is not. To avoid challenges the variable names will always be uppercased.
Next step is to bind the JavaScript to a button.
As example we will bind this to a button on a panel, on the OnCommand event:
And lastly, the API will not be enabled by default.
To do so you can enable the API and the allowed function in the deployment.properties file.
For instance like this:
As explanation:
servlet.host_api=true --> turns on the API
servlet.host_api_access_control_order=deny-allow --> sets the order to first process the denials, then the allowances
servlet.host_api_access_control_deny=* --> deny everything
servlet.host_api_access_control_allow=scriptFunctionCall,RetrieveValues --> except call to scriptFunctionCall and RetrieveValues
This will allow only these two calls in the API, keep all other access closed to avoid any misuse for a safe setup.
When all is configured, my live test gives the following outcome when I click the button:
Hope this clarifies and helps,
Best regards,
------------------------------
Roger van Valen
Senior manager, software engineering
Rocket Software
Dordrecht, The Netherlands
------------------------------
This is definitely possible. Instead of giving an example I can guide you through the steps here to make this possible.
Best practice it to use a Rocket MX script to retrieve the information to be provided to your JavaScript.
Our client's JavaScript API can also be configured to allow to get any host field value or global variable from JavaScript, but we recommend to create functions to get only the information needed. This to prevent misuse, as opening up the API too much could make your web application vulnerable.
In my example I've created a Rocket MX script function to retrieve a System, SubSystem and DeviceName from the logon screen:
Next, I made a JavaScript function to use the API 'scriptFunctionCall' to call this function, obtain the outcome and just alert() on the outcome.
This is just an example that displays the contents of the fields in an alert, but you can both put and get variables this way to Rocket MX script functions. and use these in JavaScript.
As a function may take some time to complete the call is asynchronous. The scriptFunctionCall will invoke the function and on completion it will call the 'callback function' with the results. You can both capture the return value (in my example called result) as well as the variables passed 'by reference'. Although we call them "by reference" when we return updated arguments, technically these will be copies of the outcome - so changing them in JavaScript will have no effect in the Rocket MX script. To change these and send them back to the session another script function should be made for updating.
Also note that the names of returning values are uppercased, because JavaScript is case sensitive but Rocket MX script is not. To avoid challenges the variable names will always be uppercased.
Next step is to bind the JavaScript to a button.As example we will bind this to a button on a panel, on the OnCommand event:
And lastly, the API will not be enabled by default.
To do so you can enable the API and the allowed function in the deployment.properties file.
For instance like this:
As explanation:
servlet.host_api=true --> turns on the API
servlet.host_api_access_control_order=deny-allow --> sets the order to first process the denials, then the allowances
servlet.host_api_access_control_deny=* --> deny everything
servlet.host_api_access_control_allow=scriptFunctionCall,RetrieveValues --> except call to scriptFunctionCall and RetrieveValues
This will allow only these two calls in the API, keep all other access closed to avoid any misuse for a safe setup.
When all is configured, my live test gives the following outcome when I click the button:
Hope this clarifies and helps,
Best regards,
------------------------------
Roger van Valen
Senior manager, software engineering
Rocket Software
Dordrecht, The Netherlands
------------------------------
I tried using this in one of my earlier program to collect data from a grid - but as JavaScript is asynchronous, the callback function was being executed even before ScriptFunctionCall was executed and subfile data was collected. I had to change the program to revert back to MX Script.
How can I have the program to wait for ScriptFunctionCall to end before the callback is executed?
Thanks,
Anand.
------------------------------
Anand Rajamani
------------------------------
Hi Roger,
I tried using this in one of my earlier program to collect data from a grid - but as JavaScript is asynchronous, the callback function was being executed even before ScriptFunctionCall was executed and subfile data was collected. I had to change the program to revert back to MX Script.
How can I have the program to wait for ScriptFunctionCall to end before the callback is executed?
Thanks,
Anand.
------------------------------
Anand Rajamani
------------------------------
I tried using this in one of my earlier program to collect data from a grid - but as JavaScript is asynchronous, the callback function was being executed even before ScriptFunctionCall was executed and subfile data was collected. I had to change the program to revert back to MX Script.
How can I have the program to wait for ScriptFunctionCall to end before the callback is executed?
Thanks,
Anand.
------------------------------
Anand Rajamani
------------------------------
The callback of the scriptFunctionCall should only be called at the moment the function called has completed and returns the variables.
I validated this again in the provided example and in our test sets, where this seems to work correct.
You may have encountered a specific situation where this mechanism fails. Can you please create a support ticket with the project attached and steps to reproduce so we can replay your precise scenario and analyze what may be wrong?
Regards,
Roger.
------------------------------
Roger van Valen
Senior manager, software engineering
Rocket Software
Dordrecht, The Netherlands
------------------------------
Hi Roger,
I tried using this in one of my earlier program to collect data from a grid - but as JavaScript is asynchronous, the callback function was being executed even before ScriptFunctionCall was executed and subfile data was collected. I had to change the program to revert back to MX Script.
How can I have the program to wait for ScriptFunctionCall to end before the callback is executed?
Thanks,
Anand.
------------------------------
Anand Rajamani
------------------------------
I tried using this in one of my earlier program to collect data from a grid - but as JavaScript is asynchronous, the callback function was being executed even before ScriptFunctionCall was executed and subfile data was collected. I had to change the program to revert back to MX Script.
How can I have the program to wait for ScriptFunctionCall to end before the callback is executed?
Thanks,
Anand.
------------------------------
Anand Rajamani
------------------------------
We ran into that issue when integrating with Fusion Charts.
The team member that worked on that used setInterval to loop until a callback variable is populated.
https://developer.mozilla.org/en-US/docs/Web/API/setInterval
Where that person was more of a Javascript programmer, I'd rather do the bulk of my coding in Seagull Script...
Use the scriptwindow control's javascript to host api call a Seagull function you create that will return the data.
The callback variable has always been populated and ready for further javascript processing in this scenario.
------------------------------
Leon Brown
Gui Developer
Vormittag Associates Inc
Ronkonkoma NY US
------------------------------
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.



