aware_support wrote
This action only gets a value of one particular attribute only. This value is returned as a parameter to the callback function and it is named "value" (in bold below):
var theVal = new AwareApp_GetAttributeValueAction ( "NP_SessionValues", 1, "TenantName", null, null, function (value) {
// do something with value, for example print it on the console:
console.log (value);
});
Printing it on the console is the EASY, basic function.
But I need to use the value outside the scope of the callback.
Since its an async call, it complicates things.
I'm in a grid, using "widget.bind("dataBound", function (e) {. "
so I cannot get my head around this.
Preferably, I like to NOT use a callback and wait for the return from GetAttributeValueAction synchronously.
I'm already in a callback function from databound, and now I need to use another callback function GetAttributeValueAction and it doesn't make sense to me how to do this.
Here's is a simplified version of my code (which gets the value correctly, but I can't use it AFTER and OUTSIDE the callback)
RENDER SCRIPT
var theVal = new AwareApp_GetAttributeValueAction ( "AA", 1, "TenantName", null, null, function (value) {
console.log( "THIS WORKS: value = " , value );
});
widget.bind("dataBound", function (e) {
var grid = e.sender;
***** I want to set a grid.option here from a value in the callback but it is undefined *****
console.log ("Getting tenant");
theVal.run ();
console.log ("Tenant name is always undefined. Yes, I know why. ", thename);
});