This is two separate questions it seems.
formatting the attributes table
You can pass a gridOptions
object in the tables object that can format columns fairly easily. See this link for details on how this looks in context.
gridOptions: {
columns: [{
field: 'incidentnm',
label: 'Name'
},{
field: 'inspdate',
label: 'Inspected',
width: 150,
get: function (object) { // allow export as a proper date
return getDateTime(object.inspdate);
},
formatter: formatDateTime
},
In the example, formatDateTime
is a function that would format your date. FYI, the attributes table and other widgets have extensive documentation in their relevent repo: https://github.com/tmcgee/cmv-widgets#attributes-tables
formatting the find widgets table.
This isn't as easy, since the widget hasn't received a lot of attention now that most people are using the Search widget that tmcgee has in the same repo. But its still possible if you modify the widget when the grid is created.
Somewhere around these lines you would have to do this:
this.resultsGrid = new Grid({
selectionMode: this.selectionMode,
cellNavigation: false,
showHeader: true,
store: this.resultsStore,
columns: [{
label: 'First Name',
field: 'first'
},
{
label: 'Last Name',
field: 'last'
},
{
label: 'Age',
field: 'age',
get: function(object){
return (new Date() - object.birthDate) / 31536000000;
}
}]
}, this.findResultsGrid);