I have managed to do this by using the context. If you need the whole code I can send it to you.
function currentProgram(context){
var title = '' + context.$data.name + '';
return title;
}
You will also need to set this
$.ajaxSetup({
async: false
});