index.html
3.5 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Plugin for handsontable using RuleJS library (formulas parser)</title>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<!-- handsontable -->
<script data-jsfiddle="common" src="bower_components/handsontable/dist/handsontable.full.js"></script>
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="bower_components/handsontable/dist/handsontable.full.css">
<!-- ruleJS -->
<script data-jsfiddle="common" src="bower_components/ruleJS/dist/full/ruleJS.all.full.js"></script>
<script data-jsfiddle="common" src="src/handsontable.formula.js"></script>
<link rel="stylesheet" media="screen" href="src/handsontable.formula.css">
<script src="lib/samples.js"></script>
<script src="lib/highlight/highlight.pack.js"></script>
<link rel="stylesheet" media="screen" href="lib/highlight/styles/github.css">
<link rel="stylesheet" media="screen" href="css/font-awesome/css/font-awesome.min.css">
<link data-jsfiddle="common" rel="stylesheet" media="screen" href="css/samples.css">
</head>
<body>
<div class="wrapper">
<div class="wrapper-row">
<div id="container">
<div class="columnLayout">
<div class="rowLayout">
<div class="descLayout">
<div class="pad" data-jsfiddle="example1">
<h2>Integration ruleJS library with Handsontable</h2>
<p>The following demo uses <code>ruleJS</code> library to parse some formulas.<br>
To enable this feature, use setting <code>formulas: true</code></p>
<div id="example1"></div>
<div id="example2"></div>
</div>
</div>
<div class="codeLayout">
<div class="pad">
<div class="jsFiddle">
<button class="jsFiddleLink" data-runfiddle="example1">Edit in jsFiddle</button>
</div>
<script data-jsfiddle="example1">
var data1 = [
['=$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]
];
var data2 = [
['=$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]
];
var container1 = $('#example1');
container1.handsontable({
data: data1,
minSpareRows: 1,
colHeaders: true,
rowHeaders: true,
contextMenu: true,
manualColumnResize: true,
formulas: true
});
var container2 = $('#example2');
container2.handsontable({
data: data2,
minSpareRows: 1,
colHeaders: true,
rowHeaders: true,
contextMenu: true,
manualColumnResize: true,
formulas: false
});
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>