UNPKG

@quantlab/handsontable

Version:

Spreadsheet-like data grid editor that provides copy/paste functionality compatible with Excel/Google Docs

44 lines (43 loc) 1.37 kB
<!doctype html> <html> <head> <meta charset='utf-8'> <title>Formula - Handsontable</title> <link rel="stylesheet" media="screen" href="../dist/@quantlab/handsontable.full.css"> <script src="../dist/@quantlab/handsontable.full.js"></script> </head> <body> <div id="xls"></div> <script> var data = [ ['=$B$2', "Maserati", "Mazda", "Mercedes", "Mini", "=A$1"], [2009, 0, 2941, 4303, 354, 5814], [2010, 5, 2905, 2867, '=SUM(A4,2,3)', '=$B1'], [2011, 4, 2517, 4822, 552, 6127], [2012, '=SUM(A2:A5)', '=SUM(B5,E3)', '=A2/B2', 12, 4151], [null, null, null, null, null], ['=transpose(a2:b3)', null, null, null, null], ]; var container = document.getElementById('xls'); var hot = new Handsontable(container, { data: data, rowHeaders: true, colHeaders: true, manualColumnResize: true, manualRowResize: true, minRows: 128, minCols: 32, colWidths: 100, contextMenu: true, outsideClickDeselects: false }); Handsontable.hooks.add('afterChange', function(changes, source) { if (source === 'edit' || source === 'undo' || source === 'autofill'){ changes.forEach(function(item) { console.log('oldVal:'+item[2]+',newVal:'+item[3]); }); } }); </script> </body> </html>