-
Notifications
You must be signed in to change notification settings - Fork 0
/
handsontable.js
91 lines (69 loc) · 2.16 KB
/
handsontable.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
if (Meteor.isClient) {
// counter starts at 0
Session.setDefault('counter', 0);
Template.hello.helpers({
counter: function () {
return Session.get('counter');
}
});
Template.hello.events({
'click button': function () {
var data = [
{
"car": "Mercedes A 160",
"year": 2011,
"price_usd": 8000,
"price_eur": 7000,
},
{
"car": "Audi A6",
"year": 2001,
"price_usd": 4000,
"price_eur": 5000,
}
]
;
var container = document.getElementById('hot'), hot;
hot = new Handsontable(container, {
data: data,
colHeaders: ['Car', 'Year', 'Price ($)', 'Price (€)'],
minSpareRows: 1,
colHeaders: true,
contextMenu: true,
columnSorting: true,
columns: [
{
data: 'car'
// 1nd column is simple text, no special options here
},
{
data: 'year',
type: 'numeric'
},
{
data: 'price_usd',
type: 'numeric',
format: '$ 0,0.00',
language: 'en', // this is the default locale, set up for USD
allowEmpty: false
},
{
data: 'price_eur',
type: 'numeric',
format: '0,0.00 $',
language: 'de',
}
]
});
}
});
Template.hello.rendered = function () {
if (!this.rendered) {
}
};
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}