What i've got now is this:
renderer : function(value) {
var ret;
var conn = new Ext.data.Connection();
conn.request({
method : 'POST',
url : rsdBackend,
params : {
get_object_by_id : 'true',
rsd_type : record.data.references_table,
object_id : value,
uid : logged_user_id
},
success : function(responseObject) {
var data = Ext.decode(responseObject.responseText);
ret = data[0].object_name;
}
});
return ret;
}
If a column contains a link to another data (foreign key in database terms) i need to show the name of the object it references to.
So, the best approach i can think of is using ajax call in renderer. It works, but the problem is: how can i return response?
The above code won't work, cause ret
is undefined where i'm trying to return
it.
How can this be done, or is there a better way?
I don't think you will be able do this this way. Ajax call is asynchronous and renderer()
function is synchronous. I can't imagine right now how you can mix it together.
You need to get all information required for renderer()
functions (for all cells!) to complete before you render the grid. Why can't you create an additional store for it, load it before and then use it?