From a8c70c0ae80945e173f0326b7461d9cc1b2be949 Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 23 Jan 2017 14:58:26 +0000 Subject: [PATCH] Adding the cellRenderer so the example and updating the docs to reflect the example changes --- src-standard/ColDefFactory.jsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src-standard/ColDefFactory.jsx b/src-standard/ColDefFactory.jsx index 91cc47c..ceca815 100644 --- a/src-standard/ColDefFactory.jsx +++ b/src-standard/ColDefFactory.jsx @@ -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; +}