Handsontable example
HTML
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<div id="example1" class="handsontable"></div>
CSS
</style><!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<script src="https://handsontable.com/lib/jquery.min.js"></script>
<script src="https://handsontable.com/dist/jquery.handsontable.full.js"></script>
<script src="https://handsontable.com/lib/numeral.de-de.js"></script>
<link rel="stylesheet" media="screen" href="https://handsontable.com/dist/jquery.handsontable.full.css">
<link rel="stylesheet" media="screen" href="https://handsontable.com/demo/css/samples.css">
<style type="text/css">
body {background: white; margin: 20px;}
h2 {margin: 20px 0;}
JavaScript
/*!
* numeral.js language configuration
* language : english united kingdom (uk)
* author : Dan Ristic : https://github.com/dristic
*/
(function () {
var language = {
delimiters: {
thousands: ',',
decimal: '.'
},
abbreviations: {
thousand: 'k',
million: 'm',
billion: 'b',
trillion: 't'
},
ordinal: function (number) {
var b = number % 10;
return (~~ (number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
},
currency: {
symbol: '£'
}
};
// Node
if (typeof module !== 'undefined' && module.exports) {
module.exports = language;
}
// Browser
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
this.numeral.language('en-gb', language);
}
}());
$(document).ready(function () {
function getCarData() {
return [
{car: "Mercedes A 160", year: 2006, price: 6999.9999},
{car: "Citroen C4 Coupe", year: 2008, price: 8330},
{car: "Audi A4 Avant", year: 2011, price: 33900},
{car: "Opel Astra", year: 2004, price: 7000},
{car: "BMW 320i Coupe", year: 2011, price: 30500}
];
}
$("#example1").handsontable({
data: getCarData(),
startRows: 7,
startCols: 4,
colHeaders: ["Car", "Year", "Price"],
columnSorting: true,
columns: [
{
data: "car"
//1nd column is simple text, no special options here
},
{
data: "year",
type: 'numeric'
},
{
data: "price",
type: 'numeric',
format: '$0,0.00',
language: 'en-gb' //this is the default locale, set up for USD
}
]
});
function bindDumpButton() {
$('body').on('click', 'button[name=dump]', function () {
var dump =...