Store field convert function not updating the value
I'm trying to use a convert function and it isn't working for some reason. The code looks like this:
Code:
{name:'provider_display_name',convert: function(v,record){
try {
var retval = '', json;
if (!Ext.isEmpty(record.resource_provider_json)){
if (Ext.isString(record.resource_provider_json)){
json = Ext.util.JSON.decode(record.resource_provider_json);
} else {
json = record.resource_provider_json;
}
}
if (Ext.isEmpty(json)){
if (!Ext.isEmpty(record.labor_provider_json)){
if (Ext.isString(record.labor_provider_json)){
json = Ext.util.JSON.decode(record.labor_provider_json);
} else {
json = record.labor_provider_json;
}
}
}
if (!Ext.isEmpty(json) && !Ext.isEmpty(json.display_name)){
retval = json.display_name;
}
return retval;
}catch(e){
global.handleError(e);
return '';
}
}},
I can do a console.log of retval before returning it and it is getting set. But in the record that loads in the grid the value is undefined. Can anyone tell me what I'm doing wrong?