This can be considered a general programming question or even logic question, as it's language independent.
I have the following piece of code in JavaScript:
...
{text: 'Modelo', dataIndex: 'model', filterable: true,
renderer: function(value) {
// this will asynchronously load the object "Model" from the database which have primary key equals to "value".
MyApp.model.Model.load(value, {
scope: this,
success: function(record, operation) {
// this will be executed if succeeded. I need to return the "record" parameter in the outer function.
}
});
return value; // There must be a way to return the "record" parameter from above.
}
},
...
As stated in the comments, there's the outer function renderer
that calls an inner asynchronous function load
that retrieves the value record
I need to return from the outer function.
I tried ugly things like an empty while
-loop waiting for a variable declared in the outer function to be set in the inner function and then return it, but no success, the loop ended up being infinite.