Adding the cellRenderer so the example and updating the docs to reflect the example changes

This commit is contained in:
Alberto
2017-01-23 14:58:26 +00:00
parent 3390411e8a
commit a8c70c0ae8

View File

@@ -25,7 +25,11 @@ export default class ColDefFactory {
cellRenderer: countryCellRenderer, pinned: true,
filterParams: {cellRenderer: countryCellRenderer, cellHeight: 20}}
,
{headerName: "DOB", field: "dob", width: 150, enableRowGroup: true, enablePivot: true, filter:'date'}
{headerName: "DOB", field: "dob", width: 90, enableRowGroup: true, enablePivot: true, filter:'date', cellRenderer: function(params) {
return pad(params.value.getDate(), 2) + '/' +
pad(params.value.getMonth() + 1, 2)+ '/' +
params.value.getFullYear();
}}
]
},
{
@@ -70,3 +74,10 @@ function countryCellRenderer(params) {
return null;
}
}
//Utility function used to pad the date formatting.
function pad(num, totalStringSize) {
let asString = num + "";
while (asString.length < totalStringSize) asString = "0" + asString;
return asString;
}