I have edited the following code to splice the fields I don't want and round the offset fields to 3 places.. Not I would like to ensure all of the Route ID fields are named Route and the MEAS fields are named Offset. Here is the current code. Is there anyway to create an alias for these column names?
'jimu-gp-resultrenderer-base jimu-gp-renderer-table', function(){ this.inherited(arguments); var fields = []; if(this.value.fields){ this.value.fields; else if(this.value.features && this.value.features.length > 0){ for(var p in this.value.features[0].attributes){ fields.push({ name: p }); } } fields.splice(0, 1); fields.splice(2, 2); var columns = array.map(fields, function(field){ return { label: field.name, field: field.name }; }); var data = array.map(this.value.features, function(feature){ feature.attributes.Offset = Math.round(feature.attributes.MEAS * 1000)/1000; return feature.attributes; memStore = new Memory({ data: data }); this.table = new OnDemandGrid({ columns: columns, store: memStore this.domNode); }); function(){ this.inherited(arguments); this.table.startup(); } });
Solved! Go to Solution.
Terry,
Something like this should work then:
var columns = array.map(fields, function(field){ var retval = { label: field.name, field: field.name }; if(field.name === "Route ID"){ retval.label = "Route"; } if(field.name === "MEAS"){ retval.label = "Offset"; } return retval; });
Terry,
Something like this should work then:
var columns = array.map(fields, function(field){ var retval = { label: field.name, field: field.name }; if(field.name === "Route ID"){ retval.label = "Route"; } if(field.name === "MEAS"){ retval.label = "Offset"; } return retval; });
that is exactly what I needed, thank you so much!!