PDA

View Full Version : [Solved] two fields renderer



Radziu
4 Feb 2008, 5:24 AM
I have some fields in grid panel i would like to connect two fields where i have data. when i use this renderer:



function opisRender(value, p, record){

return String.format('{0},{1}', value, record.data['sample_data2']);
}

i see in results: "sample_data1, null" or "null, sample_data2" How can i made renderer which will show me not null data from this two fields?

Condor
4 Feb 2008, 5:41 AM
Something like:


function opisRender(value, p, record){
var value2 = record.get('sample_data2');
return (value ? value : '') + (value && value2 ? ',' : '') + (value2 ? value2 : '');
}

Radziu
4 Feb 2008, 5:55 AM
Condor, thanks great sample!