Handsontable example
HTML
<div id="hot"></div>
<br/><br/>
<div>
<div>Converted:</div>
<br/>
<div id="converted">
</div>
</div>
CSS
#hot {overflow: hidden; width: 500px; height: 300px;}
</style><!-- Ugly Hack due to jsFiddle issue -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.1/moment.min.js"></script>
<script src="https://handsontable.com/static/bower_components/handsontable-pro/dist/handsontable.full.js"></script>
<link href="https://handsontable.com/static/bower_components/handsontable-pro/dist/handsontable.full.css" type="text/css" rel="stylesheet">
JavaScript
var converted = moment("\/Date(665964000000)\/");
alert("The parsed date is:\n" + converted.toString());
document.addEventListener("DOMContentLoaded", function() {
var dataObj = [
{
"id": 1,
"flag": "EUR",
"currencyCode": "EUR",
"currency": "Euro",
"level": 0.9033,
"units": "EUR / USD",
"asOf": "\/Date(665964000000)\/",
"onedChng": 0.0026
}
];
var currencyCodes =[
"EUR",
"JPY",
"GBP",
"CHF",
"CAD",
"AUD",
"NZD",
"SEK",
"NOK",
"BRL",
"CNY",
"RUB",
"INR",
"TRY",
"THB",
"IDR",
"MYR",
"MXN",
"ARS",
"DKK",
"ILS",
"PHP"
]
var flagRenderer = function (instance, td, row, col, prop, value, cellProperties) {
var currencyCode = value;
while (td.firstChild) {
td.removeChild(td.firstChild);
}
if (currencyCodes.indexOf(currencyCode) > -1) {
var flagElement = document.createElement('DIV');
flagElement.className = 'flag ' + currencyCode.toLowerCase();
td.appendChild(flagElement);
} else {
var textNode = document.createTextNode(value === null ? '' : value);
td.appendChild(textNode);
}
};
var hotElement = document.getElementById('hot');
var hot = new Handsontable(hotElement, {
data: dataObj, // see the Data tab
columns: [
{
data: "id",
type: "numeric",
width: 40,
renderer: flagRenderer
},
{
data: "flag"
},
{
data: "currencyCode",
type: "text"
},
{
data: "currency",
type: "text"
},
{
data: "level",
type: "numeric",
format: "0.0000"
},
{
data: "units",
type: "text"
},
{
data: "asOf",
type: "date",
dateFormat: "MM/DD/YYYY"
},
{
...